@e-llm-studio/instant-learning 0.0.39 → 0.0.40

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.
package/dist/index.esm.js CHANGED
@@ -298,7 +298,7 @@ const n7=Z8("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7
298
298
  * This source code is licensed under the ISC license.
299
299
  * See the LICENSE file in the root directory of this source tree.
300
300
  */
301
- const r7=Z8("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),a7=Z8("volume-off",[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]]);Z8("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);Z8("volume",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]]);Z8("vote",[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]]);Z8("wallet-cards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]);Z8("wallet-minimal",[["path",{d:"M17 14h.01",key:"7oqj8z"}],["path",{d:"M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14",key:"u1rqew"}]]);Z8("wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);Z8("wallpaper",[["circle",{cx:"8",cy:"9",r:"2",key:"gjzl9d"}],["path",{d:"m9 17 6.1-6.1a2 2 0 0 1 2.81.01L22 15V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"69xh40"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}]]);Z8("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);Z8("wand",[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]]);Z8("warehouse",[["path",{d:"M18 21V10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v11",key:"pb2vm6"}],["path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 1.132-1.803l7.95-3.974a2 2 0 0 1 1.837 0l7.948 3.974A2 2 0 0 1 22 8z",key:"doq5xv"}],["path",{d:"M6 13h12",key:"yf64js"}],["path",{d:"M6 17h12",key:"1jwigz"}]]);Z8("washing-machine",[["path",{d:"M3 6h3",key:"155dbl"}],["path",{d:"M17 6h.01",key:"e2y6kg"}],["rect",{width:"18",height:"20",x:"3",y:"2",rx:"2",key:"od3kk9"}],["circle",{cx:"12",cy:"13",r:"5",key:"nlbqau"}],["path",{d:"M12 18a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 1 0-5",key:"17lach"}]]);Z8("watch",[["path",{d:"M12 10v2.2l1.6 1",key:"n3r21l"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}]]);Z8("waves-ladder",[["path",{d:"M19 5a2 2 0 0 0-2 2v11",key:"s41o68"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}],["path",{d:"M7 13h10",key:"1rwob1"}],["path",{d:"M7 9h10",key:"12czzb"}],["path",{d:"M9 5a2 2 0 0 0-2 2v11",key:"x0q4gh"}]]);Z8("waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);Z8("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);Z8("webcam",[["circle",{cx:"12",cy:"10",r:"8",key:"1gshiw"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 22h10",key:"10w4w3"}],["path",{d:"M12 22v-4",key:"1utk9m"}]]);Z8("webhook-off",[["path",{d:"M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15",key:"1tvl6x"}],["path",{d:"M9 3.4a4 4 0 0 1 6.52.66",key:"q04jfq"}],["path",{d:"m6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05",key:"azowf0"}],["path",{d:"M20.3 20.3a4 4 0 0 1-2.3.7",key:"5joiws"}],["path",{d:"M18.6 13a4 4 0 0 1 3.357 3.414",key:"cangb8"}],["path",{d:"m12 6 .6 1",key:"tpjl1n"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);Z8("webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);Z8("weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]);Z8("wheat-off",[["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"m16 8-1.17 1.17",key:"1qqm82"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"m8 8-.53.53a3.5 3.5 0 0 0 0 4.94L9 15l1.53-1.53c.55-.55.88-1.25.98-1.97",key:"4wz8re"}],["path",{d:"M10.91 5.26c.15-.26.34-.51.56-.73L13 3l1.53 1.53a3.5 3.5 0 0 1 .28 4.62",key:"rves66"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"m16 16-.53.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.49 3.49 0 0 1 1.97-.98",key:"ak46r"}],["path",{d:"M18.74 13.09c.26-.15.51-.34.73-.56L21 11l-1.53-1.53a3.5 3.5 0 0 0-4.62-.28",key:"1tw520"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);Z8("wheat",[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]]);Z8("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);Z8("wifi-cog",[["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"M2 7.82a15 15 0 0 1 20 0",key:"1ovjuk"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["path",{d:"M5 11.858a10 10 0 0 1 11.5-1.785",key:"3sn16i"}],["path",{d:"M8.5 15.429a5 5 0 0 1 2.413-1.31",key:"1pxovh"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);Z8("wifi-high",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);Z8("wifi-low",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);Z8("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);Z8("wifi-pen",[["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["path",{d:"M5 12.859a10 10 0 0 1 10.5-2.222",key:"rpb7oy"}],["path",{d:"M8.5 16.429a5 5 0 0 1 3-1.406",key:"r8bmzl"}]]);Z8("wifi-zero",[["path",{d:"M12 20h.01",key:"zekei9"}]]);Z8("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);Z8("wind-arrow-down",[["path",{d:"M10 2v8",key:"d4bbey"}],["path",{d:"M12.8 21.6A2 2 0 1 0 14 18H2",key:"19kp1d"}],["path",{d:"M17.5 10a2.5 2.5 0 1 1 2 4H2",key:"19kpjc"}],["path",{d:"m6 6 4 4 4-4",key:"k13n16"}]]);Z8("wine-off",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);Z8("wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);Z8("wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]);Z8("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);Z8("worm",[["path",{d:"m19 12-1.5 3",key:"9bcu4o"}],["path",{d:"M19.63 18.81 22 20",key:"121v98"}],["path",{d:"M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z",key:"1tij6q"}]]);Z8("wrap-text",[["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["path",{d:"M3 18h7",key:"sq21v6"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);Z8("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);Z8("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);Z8("youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);Z8("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);Z8("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);Z8("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);Z8("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);var o7=function(t){var r=t.amplitude,a=t.variant,o=t.isActive,l=t.className,h=void 0===l?"":l,d=t.onClick,u=t.disabled,m=void 0!==u&&u,p=t.isConnecting,v=c(Array(40).fill(4)),f=v[0],z=v[1],g=i(null),y=function(){var e=Math.min(Math.max(r,0),1),t=Math.max(e,.2),n=Array(40).fill(0).map((function(e,n){var r=Math.sin(n+Date.now()/100)+.5*Math.random();return 5+9*Math.abs(r)*t}));z(n),g.current=requestAnimationFrame(y)};s((function(){return o?g.current=requestAnimationFrame(y):(z(Array(40).fill(4)),g.current&&cancelAnimationFrame(g.current)),function(){g.current&&cancelAnimationFrame(g.current)}}),[o,r]);var E=o?"#364152":"#D0D4DB",b="microphone"===a?o||p?n7:t7:o?r7:a7;return e("div",M({className:h,style:{position:"relative",height:"3rem",zIndex:50,width:"100%",overflow:"hidden",display:"flex",alignItems:"center"}},{children:[n("div",M({style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",height:"2rem",gap:"0.25rem"}},{children:f.map((function(e,t){return n("div",{style:{flexShrink:0,width:"4px",borderRadius:"9999px",transition:"all 100ms",backgroundColor:E,height:"".concat(e,"px"),opacity:o?1:.4}},t)}))})),n("button",M({onClick:d,disabled:m,"aria-label":"".concat(a," button"),style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"2rem",height:"2rem",borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 200ms",backgroundColor:"white",border:"1px solid ".concat(E),cursor:m?"not-allowed":"pointer"}},{children:n(b,{color:E,className:p?"animate-spin":"",style:{width:"1.25rem",height:"1.25rem"}})}))]}))};C(".welcome-message{align-items:flex-start;animation:fadeSlideIn 1.2s ease-out forwards;border-radius:.5rem;color:#333;display:fixed;font-size:1rem;line-height:1.75rem;max-width:100%;opacity:0;overflow-wrap:break-word;padding:1rem;transform:translateY(10px);white-space:pre-wrap;word-break:break-word}@keyframes fadeSlideIn{to{opacity:1;transform:translateY(0)}}");var c7,i7,l7=function(){return n("svg",M({width:"20px",height:"20px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M9.91158 12H7.45579H4L2.02268 4.13539C2.0111 4.0893 2.00193 4.04246 2.00046 3.99497C1.97811 3.27397 2.77209 2.77366 3.46029 3.10388L22 12L3.46029 20.8961C2.77983 21.2226 1.99597 20.7372 2.00002 20.0293C2.00038 19.9658 2.01455 19.9032 2.03296 19.8425L3.5 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},s7=function(t){var r=t.resetChatHistory,a=t.isStreamEnd;return e("div",M({className:j8,style:{width:"100%",padding:"0.75rem 0rem",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"#fff",borderBottom:"1px solid #e5e7eb",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.04)"}},{children:[e("span",M({style:{fontSize:"1.25rem",fontWeight:700,color:"#1f2937",flex:1,marginLeft:"0.5rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:[n("span",M({style:{color:"#5928ED"}},{children:"InstantLearning.AI"}))," Chat"]})),n(LJ,M({title:"New chat",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n("div",M({onClick:function(){console.log(B8,"hello"),a&&r()},style:{height:"1.8rem",width:"1.8rem",marginLeft:"1rem",marginRight:"0.5rem",cursor:a?"pointer":"not-allowed",backgroundColor:"transparent",transition:"transform 0.2s ease-in-out, opacity 0.2s",opacity:a?.8:.4,pointerEvents:a?"auto":"none"},onMouseOver:function(e){a&&(e.currentTarget.style.opacity="1")},onMouseOut:function(e){a&&(e.currentTarget.style.opacity="0.8")}},{children:n(B8,{})}))}))]}))},h7=function(t){var r=t.label,a=t.onToggle,o=c(!1),l=o[0],h=o[1],d=i(null);return s((function(){var e=d.current;e&&l&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.1)",e.style.transform="scale(1)",e.style.backgroundColor="#E8F5E9",e.style.color="#2E7D32")}),[l]),e("span",M({ref:d,onClick:function(){var e=!l;h(e),a(r,e)},style:{cursor:"pointer",backgroundColor:l?"#E8F5E9":"#fbfaff",color:l?"#2E7D32":"#000000de",transition:"all 0.2s ease-in-out"},onMouseEnter:function(e){l||(e.currentTarget.style.boxShadow="0 4px 12px rgba(30, 136, 229, 0.3)",e.currentTarget.style.transform="scale(1.02)",e.currentTarget.style.backgroundColor="#f0f7ff",e.currentTarget.style.color="#1E88E5")},onMouseLeave:function(e){l||(e.currentTarget.style.boxShadow="none",e.currentTarget.style.transform="scale(1)",e.currentTarget.style.backgroundColor="#fbfaff",e.currentTarget.style.color="#000000de")}},{children:[n("span",M({style:{fontWeight:"bold",fontSize:"16px",transition:"all 0.3s ease",transform:l?"scale(1.2)":"scale(1)",opacity:l?1:.9,paddingLeft:"0.25rem",paddingRight:"0.25rem"}},{children:l?"✓":"+"})),n("span",{children:r})]}))},d7=function(t){t.chatAssistantLogoUrl;var r=t.chatAssistantName,a=t.organizationName,o=t.baseUrl,l=t.setInstantLearningSuggestions,d=t.formDataState;t.hasUserFilledForm;var u=t.setHasUserFilledForm,m=t.baseWebsocketUrl,p=t.setIsNewChatClicked;t.selectedText,t.ChatIconComponent,t.ggcAssistantName;var v=t.ThinkingBulbIconComponent;t.hasUserWrittenModification;var f=t.setExtractedModification,z=t.setSave,g=t.setExtractedTooltip,y=t.setIsSaveLoading,C=t.isSaveLoading;t.save,t.instantLearningSuggestions,t.template;var L=r,k=i("".concat(L,"-").concat(a,"-").concat(N8())),w=i("".concat(N8())),S=o,x=i(null),T=i(null),O=c([]),A=O[0],R=O[1],N=c(!1),_=N[0],D=N[1],P=c(""),F=P[0],I=P[1],B=c([]),j=B[0],U=B[1],W=c(!1),$=W[0],q=W[1],G=c(!1);G[0];var Y=G[1],K=c(!0),X=K[0],Q=K[1],J=c(!0),Z=J[0],ee=J[1],te=c("");te[0];var ne=te[1],re=c(""),ae=re[0],oe=re[1],ce=c(""),ie=ce[0],le=ce[1],se=c(!1),he=se[0],de=se[1],ue=c(!1),me=ue[0],pe=ue[1],ve=c(!1),fe=ve[0],ze=ve[1],ge=c([]),ye=ge[0],Me=ge[1],Ee=h((function(){return""===(null==F?void 0:F.trim())||he}),[F,he]),be=i(null),He=c("100%"),Ve=He[0],Ce=He[1];h((function(){var e,t,n;return!(""===(null===(e=null==d?void 0:d.original)||void 0===e?void 0:e.trim())||(null==d?void 0:d.isTooltipEnabled)&&""===(null===(t=null==d?void 0:d.tooltip)||void 0===t?void 0:t.trim())||(null==d?void 0:d.isModificationEnabled)&&""===(null===(n=null==d?void 0:d.modification)||void 0===n?void 0:n.trim()))}),[d]),s((function(){var e="Please tell me how I should correct “".concat((null==d?void 0:d.original)||"","”? ");le(e)}),[d]),s((function(){var e=x.current,t=function(){var e=x.current;if(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;ze(!(n-(t+r)<=35))}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}}),[fe,X,j]);var Le=function(e){return h((function(){for(var t,n=[],r=/['"]conditions_whentoapply['"]\s*:\s*(\[\s*\]|\[\s*\{\s*['"]when_to_apply['"]\s*:\s*(['"])(?:\\.|(?!\2).)*\2\s*,\s*['"]confidence_score['"]\s*:\s*\d+\s*\}(?:\s*,\s*\{\s*['"]when_to_apply['"]\s*:\s*(['"])(?:\\.|(?!\3).)*\3\s*,\s*['"]confidence_score['"]\s*:\s*\d+\s*\})*\s*\])\s*,\s*['"]conditions_whennottoapply['"]\s*:\s*(\[\s*\]|\[\s*\{\s*['"]when_not_to_apply['"]\s*:\s*(['"])(?:\\.|(?!\5).)*\5\s*,\s*['"]confidence_score['"]\s*:\s*\d+\s*\}(?:\s*,\s*\{\s*['"]when_not_to_apply['"]\s*:\s*(['"])(?:\\.|(?!\6).)*\6\s*,\s*['"]confidence_score['"]\s*:\s*\d+\s*\})*\s*\])/,a=0,o=(null===(t=e[e.length-1])||void 0===t?void 0:t.orchestratorAndAgentsMessages)||[];a<o.length;a++){var c=o[a],i=((null==c?void 0:c.responsedata)||"").match(r);if(i)try{var l=q8.parse("{".concat(i[0],"}"));n.push(l)}catch(e){console.error("Failed to parse JSON:",e)}}return n}),[e])}(j);s((function(){var e=(null==Le?void 0:Le[(null==Le?void 0:Le.length)-1])||null;e&&(l(e),console.log("Parsed suggestions:",Le))}),[Le]);var ke=function(e){return h((function(){for(var t,n=[],r=/['"](\w+)['"]\s*:\s*['"](.*?)['"]/g,a=0,o=(null===(t=e[e.length-1])||void 0===t?void 0:t.orchestratorAndAgentsMessages)||[];a<o.length;a++){var c=o[a],i=((null==c?void 0:c.responsedata)||"").match(r);if(i)try{var l=q8.parse("{".concat(i[0],"}"));n.push(l)}catch(e){console.error("Failed to parse JSON for header message:",e)}}return n}),[e])}(j);s((function(){var e=(null==ke?void 0:ke[(null==ke?void 0:ke.length)-1])||null;e&&f(e.modification)}),[ke]);!function(e,t){s((function(){for(var n,r=0,a=(null===(n=e[e.length-1])||void 0===n?void 0:n.orchestratorAndAgentsMessages)||[];r<a.length;r++){for(var o=a[r],c=(null==o?void 0:o.responsedata)||"",i=/<wta>([\s\S]*?)<\/wta>/gi,l=[],s=void 0;null!==(s=i.exec(c));)console.log("match wta suggestion",s),l.push(s[1]);l.length&&t(l)}}),[e,t])}(j,Me);var we=function(e){return h((function(){for(var t,n=[],r=/^\{\s*(['"])(\w+)\1\s*:\s*(['"])(.*?)\3\s*\}$/,a=0,o=(null===(t=e[e.length-1])||void 0===t?void 0:t.orchestratorAndAgentsMessages)||[];a<o.length;a++){var c=o[a],i=((null==c?void 0:c.responsedata)||"").match(r);if(i){console.log("match: ",i[0]);try{var l=q8.parse(i[0]);n.push(l)}catch(e){console.error("Failed to parse JSON:",e)}}}return n}),[e])}(j);s((function(){var e=(null==we?void 0:we[(null==we?void 0:we.length)-1])||null;e&&(console.log("latestParseTooltip: ",e),g(null==e?void 0:e.tooltip))}),[we]);var Se=function(e){return h((function(){for(var t,n=[],r=/\{\s*'save'\s*:\s*(True|False|true|false)\s*\}/,a=0,o=(null===(t=e[e.length-1])||void 0===t?void 0:t.orchestratorAndAgentsMessages)||[];a<o.length;a++){var c=o[a],i=((null==c?void 0:c.responsedata)||"").match(r);if(i)try{var l=i[0].replace(/\bTrue\b/,"true").replace(/\bFalse\b/,"false").replace(/'/g,'"');console.log("corrected: ",l);var s=q8.parse(l);n.push(s)}catch(e){console.error("Failed to parse JSON:",e)}}return n}),[e])}(j);s((function(){var e,t=(null==Se?void 0:Se[(null==Se?void 0:Se.length)-1])||null;return t&&(null==t?void 0:t.save)&&!C&&(y(!0),e=setTimeout((function(){y(!1),z(t.save)}),200)),function(){clearTimeout(e)}}),[Se]),s((function(){Te(),Oe();var e=function(){var e,t=(null===(e=null==be?void 0:be.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px");Ce(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]);var xe=function(){var e=x.current;e&&setTimeout((function(){e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),ze(!1)}),100)};s((function(){(null==A?void 0:A.length)>0&&xe()}),[A]);var Te=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(S,"/api/chatbot/getChatSettings?name=").concat(L,"&organizationName=").concat(a),headers:{}};xw.request(e).then((function(e){var t,n,r;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(r=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===r?void 0:r.chatInitialMessage)&&ee(!0)})).catch((function(e){console.error(e)}))},Oe=function(){return b(void 0,void 0,void 0,(function(){var e,t;return H(this,(function(n){e="".concat(S,"/api/chat/history?name=").concat(L,"&organizationName=").concat(a);try{t={method:"GET",params:{guestSessionId:k.current},withCredentials:!0},xw.get(e,t).then((function(e){var t=e.data;t.length>0?(U(t),xe()):ee(!0)})).catch((function(e){console.error(e)}))}catch(e){q(!1),console.error(e)}return[2]}))}))};function Ae(e){var t=null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,(function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")}));return t}var Re=function(e,t,n,r,a,o){var c,i,l,s,h,d,u,m,p,v,f,z,g,y,E,b,H,C;console.log("userInput: ",a);var L={role:"assistant",content:"",id:N8()};if(null===(s=null===(l=null===(i=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===i?void 0:i.message)||void 0===l?void 0:l.content)||void 0===s?void 0:s.includes("WaitMessage: "))q(!1),Y(!0),L.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var r=e.substring(n+13);return null==r?void 0:r.replaceAll("WaitMessage: ","")}return""}((null===(u=null===(d=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult)||void 0===d?void 0:d.message)||void 0===u?void 0:u.content)+"\n\n"),U(V(V([],j,!0),[{role:"user",content:a,time:r,isFirstQuestionSent:o||!1,id:(null===(p=null===(m=null==e?void 0:e.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===p?void 0:p.requestId)||"",reply:""},L],!1));else{q(!1),Y(!1),L.content=null===(g=Ae(null===(z=null===(f=null===(v=null==e?void 0:e.chatStream)||void 0===v?void 0:v.continueChatResult)||void 0===f?void 0:f.message)||void 0===z?void 0:z.content))||void 0===g?void 0:g.replaceAll("WaitMessage: ","");var k=function(e,t,n){var r,a,o,c,i,l,s,h,d,u,m,p,v,f,z,g,y,E,b,H,C,L,k,w,S,x,T,O,A,R,N,_,D,P,F,I,B,j,U,W,$,q,G,Y,K,X,Q,J,Z,ee,te,ne,re,ae,oe,ce,ie,le,se,he,de,ue,me,pe,ve,fe,ze,ge,ye,Me,Ee,be,He,Ve,Ce,Le,ke,we,Se,xe,Te,Oe,Re,Ne,_e,De,Pe,Fe,Ie,Be,je,Ue,We,$e,qe,Ge,Ye,Ke,Xe,Qe,Je,Ze,et,tt,nt,rt,at,ot,ct,it,lt,st,ht,dt,ut,mt,pt,vt,ft,zt,gt,yt,Mt,Et,bt,Ht,Vt,Ct,Lt,kt,wt,St,xt,Tt,Ot,At,Rt,Nt,_t,Dt,Pt,Ft,It,Bt,jt,Ut,Wt,$t,qt,Gt,Yt,Kt,Xt,Qt,Jt,Zt,en,tn,nn,rn,an,on,cn,ln,sn,hn,dn,un,mn,pn;console.log("event",e,Object.keys(e)),console.log("content: ",null==e?void 0:e.data);var vn={role:"assistant",content:"",id:N8()};if(!1===(null===(o=null===(a=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.chatStream)||void 0===a?void 0:a.continueChatResult)||void 0===o?void 0:o.thinking_break)&&!0===(null===(l=null===(i=null===(c=null==e?void 0:e.data)||void 0===c?void 0:c.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===l?void 0:l.is_orchestrator)&&!1===(null===(d=null===(h=null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.chatStream)||void 0===h?void 0:h.continueChatResult)||void 0===d?void 0:d.isEnd)&&(vn.content=null===(f=Ae(null===(v=null===(p=null===(m=null===(u=null==e?void 0:e.data)||void 0===u?void 0:u.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===p?void 0:p.message)||void 0===v?void 0:v.content))||void 0===f?void 0:f.replaceAll("WaitMessage: ","")),!0===(null===(y=null===(g=null===(z=null==e?void 0:e.data)||void 0===z?void 0:z.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===y?void 0:y.thinking_break)&&!0===(null===(H=null===(b=null===(E=null==e?void 0:e.data)||void 0===E?void 0:E.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===H?void 0:H.is_orchestrator)&&!1===(null===(k=null===(L=null===(C=null==e?void 0:e.data)||void 0===C?void 0:C.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===k?void 0:k.isEnd)&&(vn.content="",t.push({responsedata:null===(T=null===(x=null===(S=null===(w=null==e?void 0:e.data)||void 0===w?void 0:w.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===x?void 0:x.message)||void 0===T?void 0:T.content,responseFrom:null===(R=null===(A=null===(O=null==e?void 0:e.data)||void 0===O?void 0:O.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===R?void 0:R.responded_by,header_message:null===(D=null===(_=null===(N=null==e?void 0:e.data)||void 0===N?void 0:N.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===D?void 0:D.header_message,finalResponseStatus:!1,explainability_id:null!==(B=null===(I=null===(F=null===(P=null==e?void 0:e.data)||void 0===P?void 0:P.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===I?void 0:I.explainability_id)&&void 0!==B?B:"",isParallelToolResponse:!1})),!1===(null===(W=null===(U=null===(j=null==e?void 0:e.data)||void 0===j?void 0:j.chatStream)||void 0===U?void 0:U.continueChatResult)||void 0===W?void 0:W.thinking_break)&&!0===(null===(G=null===(q=null===($=null==e?void 0:e.data)||void 0===$?void 0:$.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===G?void 0:G.is_orchestrator)&&!0===(null===(X=null===(K=null===(Y=null==e?void 0:e.data)||void 0===Y?void 0:Y.chatStream)||void 0===K?void 0:K.continueChatResult)||void 0===X?void 0:X.isEnd)&&(vn.content=null===(te=Ae(null===(ee=null===(Z=null===(J=null===(Q=null==e?void 0:e.data)||void 0===Q?void 0:Q.chatStream)||void 0===J?void 0:J.continueChatResult)||void 0===Z?void 0:Z.message)||void 0===ee?void 0:ee.content))||void 0===te?void 0:te.replaceAll("WaitMessage: ","")),!1===(null===(ae=null===(re=null===(ne=null==e?void 0:e.data)||void 0===ne?void 0:ne.chatStream)||void 0===re?void 0:re.continueChatResult)||void 0===ae?void 0:ae.thinking_break)&&!1===(null===(ie=null===(ce=null===(oe=null==e?void 0:e.data)||void 0===oe?void 0:oe.chatStream)||void 0===ce?void 0:ce.continueChatResult)||void 0===ie?void 0:ie.is_orchestrator)&&!1===(null===(he=null===(se=null===(le=null==e?void 0:e.data)||void 0===le?void 0:le.chatStream)||void 0===se?void 0:se.continueChatResult)||void 0===he?void 0:he.isEnd)){if((gn=null===(ue=null===(de=null==e?void 0:e.data)||void 0===de?void 0:de.chatStream)||void 0===ue?void 0:ue.continueChatResult).explainability_id&&gn.responded_by){var fn=gn.explainability_id,zn=gn.responded_by;n.has(fn)||n.set(fn,{responded_by:zn,index:t.length})}n.has(null===(pe=null===(me=null==e?void 0:e.data)||void 0===me?void 0:me.chatStream)||void 0===pe?void 0:pe.continueChatResult.explainability_id)?t[Hn=null==(yn=n.get(null===(ze=null===(fe=null===(ve=null==e?void 0:e.data)||void 0===ve?void 0:ve.chatStream)||void 0===fe?void 0:fe.continueChatResult)||void 0===ze?void 0:ze.explainability_id))?void 0:yn.index]={responsedata:null===(Ee=null===(Me=null===(ye=null===(ge=null==e?void 0:e.data)||void 0===ge?void 0:ge.chatStream)||void 0===ye?void 0:ye.continueChatResult)||void 0===Me?void 0:Me.message)||void 0===Ee?void 0:Ee.content,responseFrom:null===(Ve=null===(He=null===(be=null==e?void 0:e.data)||void 0===be?void 0:be.chatStream)||void 0===He?void 0:He.continueChatResult)||void 0===Ve?void 0:Ve.responded_by,header_message:null===(ke=null===(Le=null===(Ce=null==e?void 0:e.data)||void 0===Ce?void 0:Ce.chatStream)||void 0===Le?void 0:Le.continueChatResult)||void 0===ke?void 0:ke.header_message,finalResponseStatus:!0,explainability_id:null!==(Te=null===(xe=null===(Se=null===(we=null==e?void 0:e.data)||void 0===we?void 0:we.chatStream)||void 0===Se?void 0:Se.continueChatResult)||void 0===xe?void 0:xe.explainability_id)&&void 0!==Te?Te:"",isParallelToolResponse:!0}:t=V(V([],t,!0),[{responsedata:null===(_e=null===(Ne=null===(Re=null===(Oe=null==e?void 0:e.data)||void 0===Oe?void 0:Oe.chatStream)||void 0===Re?void 0:Re.continueChatResult)||void 0===Ne?void 0:Ne.message)||void 0===_e?void 0:_e.content,responseFrom:null===(Fe=null===(Pe=null===(De=null==e?void 0:e.data)||void 0===De?void 0:De.chatStream)||void 0===Pe?void 0:Pe.continueChatResult)||void 0===Fe?void 0:Fe.responded_by,header_message:null===(je=null===(Be=null===(Ie=null==e?void 0:e.data)||void 0===Ie?void 0:Ie.chatStream)||void 0===Be?void 0:Be.continueChatResult)||void 0===je?void 0:je.header_message,finalResponseStatus:!0,explainability_id:null!==(qe=null===($e=null===(We=null===(Ue=null==e?void 0:e.data)||void 0===Ue?void 0:Ue.chatStream)||void 0===We?void 0:We.continueChatResult)||void 0===$e?void 0:$e.explainability_id)&&void 0!==qe?qe:"",isParallelToolResponse:!1}],!1)}if(!0===(null===(Ke=null===(Ye=null===(Ge=null==e?void 0:e.data)||void 0===Ge?void 0:Ge.chatStream)||void 0===Ye?void 0:Ye.continueChatResult)||void 0===Ke?void 0:Ke.thinking_break)&&!1===(null===(Je=null===(Qe=null===(Xe=null==e?void 0:e.data)||void 0===Xe?void 0:Xe.chatStream)||void 0===Qe?void 0:Qe.continueChatResult)||void 0===Je?void 0:Je.is_orchestrator)&&!1===(null===(tt=null===(et=null===(Ze=null==e?void 0:e.data)||void 0===Ze?void 0:Ze.chatStream)||void 0===et?void 0:et.continueChatResult)||void 0===tt?void 0:tt.isEnd)){var gn,yn;(gn=null===(rt=null===(nt=null==e?void 0:e.data)||void 0===nt?void 0:nt.chatStream)||void 0===rt?void 0:rt.continueChatResult).explainability_id&&gn.responded_by&&(fn=gn.explainability_id,zn=gn.responded_by,n.has(fn)||n.set(fn,{responded_by:zn,index:t.length})),n.has(null===(ct=null===(ot=null===(at=null==e?void 0:e.data)||void 0===at?void 0:at.chatStream)||void 0===ot?void 0:ot.continueChatResult)||void 0===ct?void 0:ct.explainability_id)?t[Hn=null==(yn=n.get(null===(st=null===(lt=null===(it=null==e?void 0:e.data)||void 0===it?void 0:it.chatStream)||void 0===lt?void 0:lt.continueChatResult)||void 0===st?void 0:st.explainability_id))?void 0:yn.index]={responsedata:null===(mt=null===(ut=null===(dt=null===(ht=null==e?void 0:e.data)||void 0===ht?void 0:ht.chatStream)||void 0===dt?void 0:dt.continueChatResult)||void 0===ut?void 0:ut.message)||void 0===mt?void 0:mt.content,responseFrom:null===(ft=null===(vt=null===(pt=null==e?void 0:e.data)||void 0===pt?void 0:pt.chatStream)||void 0===vt?void 0:vt.continueChatResult)||void 0===ft?void 0:ft.responded_by,header_message:null===(yt=null===(gt=null===(zt=null==e?void 0:e.data)||void 0===zt?void 0:zt.chatStream)||void 0===gt?void 0:gt.continueChatResult)||void 0===yt?void 0:yt.header_message,finalResponseStatus:!1,explainability_id:null!==(Ht=null===(bt=null===(Et=null===(Mt=null==e?void 0:e.data)||void 0===Mt?void 0:Mt.chatStream)||void 0===Et?void 0:Et.continueChatResult)||void 0===bt?void 0:bt.explainability_id)&&void 0!==Ht?Ht:"",isParallelToolResponse:!0}:t.push({responsedata:null===(kt=null===(Lt=null===(Ct=null===(Vt=null==e?void 0:e.data)||void 0===Vt?void 0:Vt.chatStream)||void 0===Ct?void 0:Ct.continueChatResult)||void 0===Lt?void 0:Lt.message)||void 0===kt?void 0:kt.content,responseFrom:null===(xt=null===(St=null===(wt=null==e?void 0:e.data)||void 0===wt?void 0:wt.chatStream)||void 0===St?void 0:St.continueChatResult)||void 0===xt?void 0:xt.responded_by,header_message:null===(At=null===(Ot=null===(Tt=null==e?void 0:e.data)||void 0===Tt?void 0:Tt.chatStream)||void 0===Ot?void 0:Ot.continueChatResult)||void 0===At?void 0:At.header_message,finalResponseStatus:!1,explainability_id:null!==(Dt=null===(_t=null===(Nt=null===(Rt=null==e?void 0:e.data)||void 0===Rt?void 0:Rt.chatStream)||void 0===Nt?void 0:Nt.continueChatResult)||void 0===_t?void 0:_t.explainability_id)&&void 0!==Dt?Dt:"",isParallelToolResponse:!1})}var Mn=null===(Bt=null===(It=null===(Ft=null===(Pt=null==e?void 0:e.data)||void 0===Pt?void 0:Pt.chatStream)||void 0===Ft?void 0:Ft.continueChatResult)||void 0===It?void 0:It.message)||void 0===Bt?void 0:Bt.annotations,En=(null===($t=null===(Wt=null===(Ut=null===(jt=null==e?void 0:e.data)||void 0===jt?void 0:jt.chatStream)||void 0===Ut?void 0:Ut.continueChatResult)||void 0===Wt?void 0:Wt.message)||void 0===$t?void 0:$t.userFeedbackId)||"",bn={role:"assistant",content:vn.content,orchestratorAndAgentsMessages:t,time:new Date,requestId:null!==(Kt=null===(Yt=null===(Gt=null===(qt=null==e?void 0:e.data)||void 0===qt?void 0:qt.chatStream)||void 0===Gt?void 0:Gt.continueChatResult)||void 0===Yt?void 0:Yt.requestId)&&void 0!==Kt?Kt:"",citations:null===(Zt=null===(Jt=null===(Qt=null===(Xt=null==e?void 0:e.data)||void 0===Xt?void 0:Xt.chatStream)||void 0===Qt?void 0:Qt.continueChatResult)||void 0===Jt?void 0:Jt.message)||void 0===Zt?void 0:Zt.citations,guides_utilized:null!==(an=null===(rn=null===(nn=null===(tn=null===(en=null==e?void 0:e.data)||void 0===en?void 0:en.chatStream)||void 0===tn?void 0:tn.continueChatResult)||void 0===nn?void 0:nn.message)||void 0===rn?void 0:rn.guides_utilized)&&void 0!==an?an:[],annotations:Mn,resourceId:null===(ln=null===(cn=null===(on=null==e?void 0:e.data)||void 0===on?void 0:on.chatStream)||void 0===cn?void 0:cn.continueChatResult)||void 0===ln?void 0:ln.resourceId,userFeedbackId:En,citationDisplayType:null!==(mn=null===(un=null===(dn=null===(hn=null===(sn=null==e?void 0:e.data)||void 0===sn?void 0:sn.chatStream)||void 0===hn?void 0:hn.continueChatResult)||void 0===dn?void 0:dn.message)||void 0===un?void 0:un.citationDisplayType)&&void 0!==mn?mn:""};if(Mn)for(var Hn=0;Hn<(null==Mn?void 0:Mn.length);Hn++){var Vn=Mn[Hn];bn=M(M({},bn),{content:null===(pn=null==bn?void 0:bn.content)||void 0===pn?void 0:pn.replace(null==Vn?void 0:Vn.text,(null==Vn?void 0:Vn.text)+"<sup>".concat(Hn,"</sup>"))})}return bn}({data:e},n,t);console.log("assistantObject",k),U(V(V([],j,!0),[{role:"user",content:a||"",time:r,isFirstQuestionSent:o||!1,requestId:null!==(b=null===(E=null===(y=null==e?void 0:e.chatStream)||void 0===y?void 0:y.continueChatResult)||void 0===E?void 0:E.requestId)&&void 0!==b?b:""},k],!1)),Q(null===(C=null===(H=null==e?void 0:e.chatStream)||void 0===H?void 0:H.continueChatResult)||void 0===C?void 0:C.isEnd)}},Ne=function(e,t,n){var r,o=(null==n?void 0:n.trim())||(null==F?void 0:F.trim())||"";if(!("Enter"!==e.key||e.shiftKey||""===(null==n?void 0:n.trim())&&""===(null==F?void 0:F.trim())||he)){de(!0);var c=new Date;U(V(V([],j.map((function(e,t){var n;return M(M({},e),{content:null===(n=Ae(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})})),!0),[{role:"user",content:o,time:c,isFirstQuestionSent:!1}],!1));var i=new Map,l=[];D(!1);var s={WEBSOCKET_URL:m,organizationName:a,chatAssistantName:L,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:(null==n?void 0:n.trim())||(null==F?void 0:F.trim())||"",requestId:"requestId-".concat(N8()),customPrompt:"",enableForBackend:!1,guestSessionId:k.current,chatPreviewId:w.current,customMetaData:M(M({},d),{isFirstQuestion:0===j.length}),aiModel:"",onStreamEvent:function(e){return Re(e,i,l,c,o,t)},onStreamEnd:function(e){de(!1)},onError:function(e){return console.error("Stream error:",e)}};if(""!==(null==F?void 0:F.trim())||(null==n?void 0:n.trim())){q(!0),null===(r=T.current)||void 0===r||r.blur(),I(""),xe();for(var h="Thanks for sharing your thoughts. I’m putting together the most helpful suggestions now, so we can make sure this really fits your needs.".split(" "),u="",p=function(e){setTimeout((function(){u+=h[e]+" ",oe(u.trim())}),25*e)},v=0;v<h.length;v++)p(v);x8.startChatStream(s)}}},_e=h((function(){return{img:function(e){e.node;var t=E(e,["node"]);return n("img",M({},t,{style:{height:"100%",width:"100%",objectFit:"contain"},alt:(null==t?void 0:t.alt)||"",className:"w-full sm:max-w-lg md:max-w-2xl lg:max-w-4xl mx-auto"}))},p:function(e){e.node;var t=E(e,["node"]);return n("p",M({},t,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"block",fontSize:"1rem",lineHeight:"1.625rem",marginBottom:"1rem",marginTop:"10px"}},{children:null==t?void 0:t.children}))},code:function(e){e.node;var t=E(e,["node"]);return n("span",M({},t,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"inline-flex",fontSize:"1rem",lineHeight:"1.625rem"}},{children:null==t?void 0:t.children}))},ol:function(e){e.node;var t=E(e,["node"]);return n("ol",M({},t,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==t?void 0:t.children}))},ul:function(e){e.node;var t=E(e,["node"]);return n("ul",M({},t,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==t?void 0:t.children}))},wta:function(e){e.node;var t=E(e,["node"]);t.key||t["data-key"];var r=t.label||t.children||"Unknown label";return n(h7,{label:r,onToggle:function(e,t){!function(e,t){var n=Array.isArray(e)?e[0]:e;null==A||A.length,D(!0),R((function(e){return t?e.includes(n)?e:V(V([],e,!0),[n],!1):e.filter((function(e){return e!==n}))}))}(e,t)}})}}}),[]),De=h((function(){if(!Array.isArray(A)||!Array.isArray(ye))return"";var e=A.map((function(e){return ye.indexOf(e)})).filter((function(e){return-1!==e})).map((function(e){return e+1}));return e.join(" and ")}),[A,ye]);return e("div",M({className:j8,style:{height:"100%",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontFamily:"Plus Jakarta Sans, sans-serif",backgroundColor:"#fbfaff",border:"1px solid #d1d5db",overflow:"hidden"}},{children:[e("div",M({style:{width:"100%",height:"100%",backgroundColor:"#fbfaff",maxWidth:"100%",overflow:"hidden"}},{children:[n("div",M({ref:be},{children:n(s7,{resetChatHistory:function(){var e="".concat(S,"/api/chat/resetHistory?name=").concat(L,"&organizationName=").concat(a);try{var t={method:"GET",params:{guestSessionId:k.current},withCredentials:!0};xw.get(e,t).then((function(){f(""),g(""),p(!0),D(!1),R([]),ne(""),w.current="".concat(N8()),u(!1),U([]),ee(!0)})).catch((function(e){console.error(e)}))}catch(e){q(!1),console.error(e)}},isStreamEnd:X})})),e("div",M({style:{width:"100%",height:Ve,maxHeight:Ve,overflowY:"auto",backgroundColor:"#fbfaff"},ref:x},{children:[n("div",M({className:"welcome-message",style:{alignItems:"flex-start",paddingLeft:"0.5rem",paddingTop:"1rem",maxWidth:"70%",fontSize:"1rem",lineHeight:"1.75rem",borderRadius:"0.5rem",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"#333",fontWeight:"700",textAlign:"left"}},{children:n("span",{children:"I’m here to help fine-tune your learning so it works as accurately as it should."})})),j.length?j.map((function(t,r){return e("div",M({style:{display:"flex",padding:"0.5rem 1rem",maxWidth:"100%"}},{children:["assistant"==(null==t?void 0:t.role)&&n("div",M({style:{maxHeight:"32px",maxWidth:"32px",marginTop:"0.5rem",marginRight:"1rem"}},{children:e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]}))})),e("div",M({style:{width:"100%"}},{children:["assistant"===t.role&&t.orchestratorAndAgentsMessages&&t.orchestratorAndAgentsMessages.length>0&&n(I8,{orchestratorAndAgentsMessages:null==t?void 0:t.orchestratorAndAgentsMessages,isStreamEnd:X,isCurrentMessage:r===j.length-1,ThinkingBulbIconComponent:v}),"assistant"===(null==t?void 0:t.role)?n(vM,M({components:_e,rehypePlugins:[sC]},{children:t.content}),r):n("span",{}),n("div",M({style:{display:"flex",justifyContent:"flex-end"}},{children:"user"===t.role?n("div",M({style:{backgroundColor:"#8694A10D",padding:"0 1rem",borderRadius:"8px",maxWidth:"80%"}},{children:n(vM,M({components:_e,rehypePlugins:[sC]},{children:t.content}),r)})):n("span",{})}))]}))]}))})):Z&&e("div",M({style:{display:"flex",flexDirection:"row",fontFamily:"inherit",padding:"16px 10px 0px 16px",maxWidth:"80%"}},{children:[n("div",M({style:{maxHeight:"32px",maxWidth:"32px",marginTop:"0.3rem"}},{children:e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]}))})),n("div",M({style:{display:"flex",flexDirection:"column",fontWeight:400,color:"#000"}},{children:n("div",M({style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:"1rem",paddingRight:"1rem",width:"100%",maxWidth:"100%",fontSize:"1rem",lineHeight:"1.75rem",marginBottom:"1rem",borderRadius:"0.5rem",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"#333"}},{children:n("span",{children:n(vM,M({components:{p:function(e){e.node;var t=E(e,["node"]);return n("p",M({},t,{style:{margin:0}},{children:null==t?void 0:t.children}))}}},{children:ie}))})}))}))]})),n("div",M({style:{display:"flex",padding:"0.5rem 1rem",maxWidth:"100%"}},{children:n("div",M({style:{width:"100%",marginLeft:"2.75rem"}},{children:(null==A?void 0:A.length)>0&&_?e("span",{children:["It looks like you’ve chosen ",A.length>1?"suggestions":"suggestion"," ",De,". Would you like me to proceed with them?",n("p",{children:n("button",M({style:{padding:"0.5rem 1rem",margin:"1rem 0rem",backgroundColor:"#4CAF50",color:"white",border:"none",borderRadius:"8px",cursor:"pointer",fontSize:"0.75rem",fontWeight:"500",boxShadow:"0 2px 5px rgba(0, 0, 0, 0.2)",transition:"background-color 0.3s",fontFamily:"Plus Jakarta Sans, sans-serif"},onClick:function(e){Ne(new KeyboardEvent("keydown",{key:"Enter"}),!1,"I want the when to apply conditions to be ".concat(A.join(" or ")))}},{children:"Yes"}))})]}):n("span",{})}))})),$&&e("div",M({style:{display:"flex",padding:"16px 16px 0px 16px"}},{children:[n("div",M({style:{maxHeight:"32px",maxWidth:"32px",marginTop:"0.2rem"}},{children:e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]}))})),n("div",M({style:{display:"inline-flex",alignItems:"flex-start",paddingLeft:"1rem",paddingRight:"1rem",paddingBottom:"1rem",width:"100%",maxWidth:"100%",fontSize:"1rem",lineHeight:"1.75rem",marginBottom:"1rem",borderRadius:"0.5rem",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"#333"}},{children:n("span",{children:ae})}))]}))]}))]})),e("div",M({style:{width:"95%",height:"content-fit",backgroundColor:"#fbfaff",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"end",position:"relative"}},{children:[n("div",M({style:{visibility:fe?"visible":"hidden",position:"absolute",top:"-3rem",zIndex:0,pointerEvents:"none"}},{children:n("button",M({onClick:xe,style:{borderRadius:"9999px",padding:0,backgroundColor:"#fff",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",border:"1px solid #d1d5db",pointerEvents:"auto",cursor:"pointer",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1,height:"2.25rem",width:"2.25rem",margin:"0.3rem"}},{children:n("svg",M({fill:"#000000",width:"16px",height:"16px",viewBox:"0 0 24 24",id:"down","data-name":"Flat Color",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{id:"primary",d:"M19.71,13.29a1,1,0,0,0-1.42,0L13,18.59V3a1,1,0,0,0-2,0V18.59l-5.29-5.3a1,1,0,0,0-1.42,1.42l7,7a1,1,0,0,0,1.42,0l7-7A1,1,0,0,0,19.71,13.29Z"})}))}))})),n("div",M({style:{width:"100%",backgroundColor:"#fff",display:"flex",alignItems:"end",gap:"0.5rem",border:"1px solid #E5E7EB",borderRadius:"8px"}},{children:e("div",M({style:{width:"100%",display:"flex"}},{children:[n("textarea",{ref:T,placeholder:"Tell me more about this learning...",value:F||"",onChange:function(e){return I(e.target.value)},onFocus:function(){return pe(!0)},onBlur:function(){return pe(!1)},onKeyDown:function(e){return Ne(e)},style:{flexGrow:1,padding:"0.5rem",borderRadius:"0.5rem",border:"none",fontSize:"1rem",lineHeight:"1.5rem",resize:"none",backgroundColor:"#fff",color:"inherit",minHeight:me?"120px":"50px",height:me?"120px":"50px",maxHeight:"120px",overflowY:"auto",fontFamily:"inherit",outline:"none",transition:"min-height 0.3s ease, background-color 0.3s ease",boxSizing:"border-box"}}),e("span",M({style:{display:"flex",flexDirection:"column",justifyContent:"end",alignItems:"end"}},{children:[" ",n("button",M({onClick:function(e){Ne(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Ee,style:{padding:"0.5rem 0.75rem",borderRadius:"0.375rem",border:"none",backgroundColor:"white",color:Ee?"#d1d5db":"#5928ed",fontWeight:"bold",fontSize:"1rem",cursor:Ee?"not-allowed":"pointer",transition:"background-color 0.3s, color 0.3s",height:"50px"}},{children:n(l7,{})}))]}))]}))}))]})),e("div",M({style:{width:"95%",display:"flex",gap:"0.25rem",flexDirection:"row"}},{children:[n(LJ,M({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n("span",M({style:{width:"50%"}},{children:n(o7,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),n(LJ,M({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n("span",M({style:{width:"50%"}},{children:n(o7,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))},u7={},m7={exports:{}},p7={exports:{}};function v7(){return c7||(c7=1,function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(p7)),p7.exports}function f7(){return i7||(i7=1,function(e){var t=v7().default;function n(r,a){if("function"==typeof WeakMap)var o=new WeakMap,c=new WeakMap;return(e.exports=n=function(e,n){if(!n&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=t(e)&&"function"!=typeof e)return i;if(r=n?c:o){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i},e.exports.__esModule=!0,e.exports.default=e.exports)(r,a)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(m7)),m7.exports}var z7,g7,y7={},M7=Te(rl);function E7(){return z7||(z7=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=M7}(y7)),y7}var b7,H7=function(){if(g7)return u7;g7=1;var e=p_(),t=f7();Object.defineProperty(u7,"__esModule",{value:!0}),u7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");return u7.default=r,u7}(),V7=xe(H7),C7={};var L7,k7=function(){if(b7)return C7;b7=1;var e=p_(),t=f7();Object.defineProperty(C7,"__esModule",{value:!0}),C7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"}),"Lock");return C7.default=r,C7}(),w7=xe(k7),S7={};var x7=function(){if(L7)return S7;L7=1;var e=p_(),t=f7();Object.defineProperty(S7,"__esModule",{value:!0}),S7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 00-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),"Edit");return S7.default=r,S7}(),T7=xe(x7),O7=function(t){var r=t.selectedText,a=t.scopeOptions,o=t.devModeTag,d=t.chatLogo,u=void 0===d?null:d,m=t.submitFunction;t.setShowChat,t.showChat;var p=t.setFormDataState,v=t.instantLearningSuggestions;t.setHasUserFilledForm,t.hasUserFilledForm;var f=t.isNewChatClicked,z=t.setIsNewChatClicked,g=t.setHasUserWrittenModification,y=t.extractedModification,E=t.save,b=t.extractedTooltip;t.isSaveLoading;var H=c({context:"",issue_with_response:"",original:null!=r?r:"",modification:"",whenToApply:"",whenNotToApply:"",tooltip:"",scope:a[0].value,isTooltipEnabled:!1,isModificationEnabled:!0,isDevMode:!1}),C=H[0],L=H[1],k=c(!1),w=k[0],S=k[1],x=c(!1),T=x[0],O=x[1],A=c(!1),R=A[0],N=A[1],_=c(!1),D=_[0],P=_[1],F=c([]),I=F[0],B=F[1],j=c([]),U=j[0],W=j[1],$=c(!1),q=$[0],G=$[1],Y=c(!1),K=Y[0],X=Y[1],Q=c(!1),J=Q[0],Z=Q[1],ee=h((function(){var e,t,n,r,a=""!==(null===(e=null==C?void 0:C.original)||void 0===e?void 0:e.trim()),o=""!==(null===(t=null==C?void 0:C.whenToApply)||void 0===t?void 0:t.trim()),c=(null==I?void 0:I.length)>0,i=!(null==C?void 0:C.isTooltipEnabled)||""!==(null===(n=null==C?void 0:C.tooltip)||void 0===n?void 0:n.trim()),l=!0;return(null==C?void 0:C.isModificationEnabled)&&(l=""!==(null===(r=null==C?void 0:C.modification)||void 0===r?void 0:r.trim())),a&&o&&c&&(i||l)}),[C,I,v]),te=i(null);s((function(){if(""===y&&(null==C?void 0:C.isTooltipEnabled)&&L((function(e){return M(M({},e),{isModificationEnabled:!1})})),""!==y||(null==C?void 0:C.isTooltipEnabled)||L((function(e){return M(M({},e),{modification:""})})),y&&""!==y){L((function(e){return M(M({},e),{modification:y,isModificationEnabled:!0})})),P(!0);var e=setTimeout((function(){P(!1)}),400);return function(){return clearTimeout(e)}}}),[y]),s((function(){""===b&&L((function(e){return M(M({},e),{isTooltipEnabled:!1})})),b&&""!==b&&L((function(e){return M(M({},e),{tooltip:b,isTooltipEnabled:!0})}))}),[b]),s((function(){f&&(L((function(e){return M(M({},e),{modification:"",tooltip:"",isTooltipEnabled:!1,isModificationEnabled:!0})})),B([]),W([]),z(!1))}),[f]),s((function(){p(C)}),[C]),s((function(){""===C.original.trim()||""===C.modification.trim()&&""===C.tooltip.trim()||w||S(!0)}),[C]),s((function(){if((null==I?void 0:I.length)>0&&!q){O(!0);var e=setTimeout((function(){O(!1)}),400);return function(){return clearTimeout(e)}}}),[JSON.stringify(I)]),s((function(){if((null==U?void 0:U.length)>0&&!K){N(!0);var e=setTimeout((function(){N(!1)}),400);return function(){return clearTimeout(e)}}}),[JSON.stringify(U)]),s((function(){var e,t,n,r;if(v){G(!1),X(!1);var a=null===(e=null==v?void 0:v.conditions_whentoapply)||void 0===e?void 0:e.map((function(e){return e.when_to_apply})),o=null===(t=null==v?void 0:v.conditions_whennottoapply)||void 0===t?void 0:t.map((function(e){return e.when_not_to_apply}));(null===(n=null==v?void 0:v.conditions_whentoapply)||void 0===n?void 0:n.length)&&(B(a),L((function(e){return M(M({},e),{whenToApply:null==a?void 0:a.join(" OR ")})}))),(null===(r=null==v?void 0:v.conditions_whennottoapply)||void 0===r?void 0:r.length)&&(W(o),L((function(e){return M(M({},e),{whenNotToApply:null==o?void 0:o.join(" OR ")})})))}}),[v]);var ne,re=i(null),ae=l((function(){re.current&&clearTimeout(re.current),re.current=setTimeout((function(){g(!0)}),1e3)}),[]),oe=l((function(e){return function(t){L((function(n){var r;return M(M({},n),((r={})[e]=t.target.value,r))})),ae()}}),[ae]),ce=function(e){return e.replace(new RegExp("<".concat(o,">"),"gi"),"").replace(new RegExp("</".concat(o,">"),"gi"),"").replace(/<\/?[^>]+(>|$)/g,"")},ie=l((function(e){var t=ce(e);L((function(e){return M(M({},e),{tooltip:t})})),ae()}),[ae]),le=function(e){return function(t){var n=t.target.checked,r={};"isTooltipEnabled"===e?r={tooltip:n?C.tooltip:"",isModificationEnabled:!n||C.isModificationEnabled}:"isModificationEnabled"===e&&(r={modification:n?C.modification:""}),L((function(t){var a;return M(M(M({},t),r),((a={})[e]=n,a))}))}},se=function(){console.log("Form submitted:",C),Z(!0),""===(null==C?void 0:C.modification)&&L((function(e){return M(M({},e),{isModificationEnabled:!1})})),""===(null==C?void 0:C.tooltip)&&L((function(e){return M(M({},e),{isTooltipEnabled:!1})})),m(C,Z)};return s((function(){E&&se()}),[E]),e(Yj,M({p:0,className:j8,sx:{display:"flex",flexDirection:"column",height:"100%",width:"100%"}},{children:[n(Yj,{children:n(iF,M({sx:{fontSize:20,fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:"Instant Learning"}))}),e(Yj,M({sx:{fontFamily:"Plus Jakarta Sans",display:"flex",flexDirection:"column",gap:2,justifyContent:"space-between",flexGrow:1,paddingTop:"20px",height:"calc(100% - 30px)",overflow:"hidden"}},{children:[e(Yj,M({sx:{display:"flex",flexDirection:"column",gap:"20px",height:"calc(100% - 90px)",overflow:"hidden"}},{children:[e(Yj,M({sx:{display:"flex",gap:2}},{children:[e(Yj,M({sx:{flex:1}},{children:[e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[e(iF,M({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center"}},{children:["Original"," ",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Original word/phrase which needs to be replaced",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),n(YZ,{sx:{visibility:"hidden"},disabled:!0})]})),n(j2,{sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}},id:"original",value:C.original,onChange:oe("original"),fullWidth:!0,placeholder:"Enter original"})]})),e(Yj,M({sx:{flex:1}},{children:[e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[e(iF,M({sx:{fontFamily:"Plus Jakarta Sans",fontWeight:600,fontSize:"1rem",display:"flex",alignItems:"center"}},{children:["Modification",C.isModificationEnabled&&!C.isTooltipEnabled&&n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Modified word/phrase which Original needs to be replaced with",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),n(YZ,{checked:C.isModificationEnabled,disabled:!C.isTooltipEnabled,onChange:le("isModificationEnabled"),sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#5928ed"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:"#5928ed"}}})]})),C.isModificationEnabled&&n(j2,{sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},boxShadow:D?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out"},id:"modification",value:C.modification,onChange:oe("modification"),fullWidth:!0,placeholder:"Change ".concat(r," to...")})]}))]})),e(Yj,M({sx:{display:"flex",gap:2}},{children:[n(Yj,{sx:{flex:1}}),e(Yj,M({sx:{flex:1}},{children:[e(Yj,M({sx:{display:"flex",justifyContent:"space-between"}},{children:[e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"}},{children:["Tooltip",C.isTooltipEnabled&&n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Adds a tooltip to the modification or the original word",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),n(YZ,{checked:C.isTooltipEnabled,onChange:le("isTooltipEnabled"),sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#5928ed"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:"#5928ed"}}})]})),C.isTooltipEnabled&&e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[n(iF,M({sx:{fontSize:14,fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:"Dev Mode"})),n(YZ,{checked:C.isDevMode,onChange:le("isDevMode"),sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#4b5563"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:"#4b5563"}}})]}))]})),C.isTooltipEnabled&&n(j2,{id:"tooltip",inputRef:te,value:function(){var e=ce(C.tooltip);return C.isDevMode?"<".concat(o,">").concat(e,"</").concat(o,">"):e}(),onChange:function(e){return ie(e.target.value)},onFocus:function(){setTimeout((function(){if(C.isDevMode){var e=ce(C.tooltip),t="<".concat(o,">").length+e.length,n=te.current;n&&n.setSelectionRange(t,t)}}),0)},fullWidth:!0,placeholder:C.isDevMode?"<".concat(o,">Enter tooltip content</").concat(o,">"):"Enter tooltip content",sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}}})]}))]})),e(Yj,M({sx:{display:"flex",gap:2,height:"".concat(C.isTooltipEnabled?"calc(100% - 248px)":"calc(100% - 200px)")}},{children:[!(null==I?void 0:I.length)&&e(Yj,M({sx:{flex:1}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When To Apply",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Specific situations or conditions where this learning should be applied.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 64px)",display:"flex",flexDirection:"column"}},{children:[e("div",M({style:{width:"100%",display:"flex",gap:"0.25rem"}},{children:[e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),n("div",M({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:e("div",M({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[n("div",M({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),e("div",M({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[n("div",M({style:{}},{children:"Tell us about your learning in "})),n("span",M({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",n("span",{children:"Chat"})]}))]}))}))]}))]})),(null==I?void 0:I.length)>0&&e(Yj,M({sx:{flex:1,height:"100%"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans, sans-serif",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When To Apply",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Specific situations or conditions where this learning should be applied.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 64px)",boxShadow:T?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",marginLeft:"4px"}},{children:[e(Yj,M({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:[e(Yj,M({display:"flex",gap:"0.25rem",alignItems:"center"},{children:[u&&n(Yj,{component:"img",src:u,alt:"Chat",sx:{width:14,height:14}}),e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),(null==I?void 0:I.length)>0&&n(LJ,M({title:q?"Save & Lock":"Edit",componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(UP,M({disabled:I.some((function(e){return""===(null==e?void 0:e.trim())})),onClick:function(){return G((function(e){return!e}))},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:n(q?w7:T7,{fontSize:"small"})}))}))]})),n(Yj,M({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:n("ol",M({style:{paddingLeft:"0rem",fontFamily:"Plus Jakarta Sans",margin:0}},{children:T?e(Yj,M({sx:{display:"flex",justifyContent:"center",py:2,gap:2}},{children:[n(xW,{size:24}),n("span",{children:"Generating When to apply..."})]})):n(Yj,M({sx:{pt:"16px"}},{children:I.map((function(t,r){return e(Yj,M({sx:{display:"flex",alignItems:"flex-start",gap:1,mb:r<I.length-1?2:0,fontFamily:"Plus Jakarta Sans"},component:"li"},{children:[n(j2,{variant:"outlined",disabled:!q,fullWidth:!0,multiline:!0,value:"".concat(t),error:!t.trim(),onChange:function(e){var t=V([],I,!0);t[r]=e.target.value,B(t),L((function(e){return M(M({},e),{whenToApply:t.join(" OR ")})}))},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}},InputProps:{startAdornment:e(VG,M({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[r+1,"."]}))}}),q&&n(UP,M({onClick:function(){if(I.length>1){var e=I.filter((function(e,t){return t!==r}));B(e),L((function(t){return M(M({},t),{whenToApply:e.join(" OR ")})}))}},sx:{mt:1}},{children:n(V7,{})}))]}),r)}))}))}))}))]}))]})),!(null==U?void 0:U.length)&&e(Yj,M({sx:{flex:1}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When Not To Apply",n(LJ,M({title:"Cases where this learning should not be applied to avoid incorrect responses.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,flex:1,display:"flex",flexDirection:"column",height:"calc(100% - 64px)"}},{children:[e("div",M({style:{width:"100%",display:"flex",gap:"0.25rem"}},{children:[e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),n("div",M({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:e("div",M({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[n("div",M({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),e("div",M({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[n("div",M({style:{}},{children:"Tell us about your learning in "})),n("span",M({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",n("span",{children:"Chat"})]}))]}))}))]}))]})),(null==U?void 0:U.length)>0&&e(Yj,M({sx:{flex:1,height:"100%"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When Not To Apply",n(LJ,M({title:"Cases where this learning should not be applied to avoid incorrect responses.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 64px)",boxShadow:R?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",marginRight:"4px"}},{children:[e(Yj,M({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:[e(Yj,M({display:"flex",gap:"0.25rem",alignItems:"center"},{children:[u&&n(Yj,{component:"img",src:u,alt:"Chat",sx:{width:14,height:14}}),e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),(null==U?void 0:U.length)>0&&n(LJ,M({placement:"top",arrow:!0,title:K?"Save & Lock":"Edit",componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(UP,M({disabled:U.some((function(e){return""===(null==e?void 0:e.trim())})),onClick:function(){return X((function(e){return!e}))},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:n(K?w7:T7,{fontSize:"small"})}))}))]})),n(Yj,M({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:n("ol",M({style:{paddingLeft:"0rem",margin:0}},{children:R?e(Yj,M({sx:{display:"flex",justifyContent:"center",py:2,gap:2}},{children:[n(xW,{size:24}),n("span",{children:"Generating When not to apply..."})]})):n(Yj,M({sx:{pt:"16px"}},{children:U.map((function(t,r){return e(Yj,M({sx:{display:"flex",alignItems:"flex-start",gap:1,mb:r<U.length-1?2:0},component:"li"},{children:[n(j2,{variant:"outlined",disabled:!K,fullWidth:!0,multiline:!0,value:"".concat(t),error:!t.trim(),onChange:function(e){var t=V([],U,!0);t[r]=e.target.value,W(t),L((function(e){return M(M({},e),{whenNotToApply:t.join(" OR ")})}))},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}},InputProps:{startAdornment:e(VG,M({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[r+1,"."]}))}}),K&&n(UP,M({onClick:function(){if(U.length>1){var e=U.filter((function(e,t){return t!==r}));W(e),L((function(t){return M(M({},t),{whenNotToApply:e.join(" OR ")})}))}},disabled:1===U.length,sx:{mt:1}},{children:n(V7,{})}))]}),r)}))}))}))}))]}))]}))]}))]})),e(Yj,M({sx:{display:"flex",gap:2}},{children:[e(Yj,M({sx:{flex:1}},{children:[n(iF,M({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"},gutterBottom:!0},{children:"Scope"})),n(tq,M({sx:{width:"50%",fontFamily:"Plus Jakarta Sans"},variant:"outlined"},{children:e(iQ,M({id:"scope",value:C.scope,onChange:(ne="scope",function(e){L((function(t){var n;return M(M({},t),((n={})[ne]=e.target.value,n))}))}),displayEmpty:!0,sx:{fontFamily:"Plus Jakarta Sans"},fullWidth:!0},{children:[n(dK,M({value:"",disabled:!0},{children:"Select scope"})),a.map((function(e,t){return n(dK,M({value:e.value,sx:{fontFamily:"Plus Jakarta Sans"}},{children:e.labelText}),t)}))]}))}))]})),n(Yj,M({sx:{flex:1,display:"flex",alignItems:"flex-end",justifyContent:"flex-end"}},{children:e(zU,M({variant:"contained",onClick:se,sx:{width:"30%",height:"56px",fontFamily:"Plus Jakarta Sans",backgroundColor:"green",textTransform:"capitalize","&:hover":{backgroundColor:"#006400"}},disabled:!ee},{children:[J&&n(xW,{sx:{marginRight:"8px",color:"#fff"},size:16}),J?"Saving":"Save"]}))}))]}))]}))]}))},A7=function(t){var r=t.options,a=t.label,o=void 0===a?"Select Template for Stormee":a,i=t.required,l=void 0===i||i,s=t.onChange,h=t.setSelectedTemplate,d=c(""),u=d[0],m=d[1];return e(tq,M({size:"small",style:{minWidth:200,backgroundColor:"#fff",borderRadius:12}},{children:[e(iF,M({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"0.95rem",fontWeight:600,marginBottom:"6px",color:"#1a1a1a",display:"flex",alignItems:"center"}},{children:[o,l&&n(Yj,M({component:"span",sx:{color:"red",marginLeft:"4px"}},{children:"*"}))]})),e(iQ,M({value:u,displayEmpty:!0,onChange:function(e){var t=e.target.value;m(t),null==s||s(t),h(t)},style:{borderRadius:10,fontWeight:500,fontSize:15,fontFamily:"Plus Jakarta Sans",color:u?"#5928ed":"#888",padding:"10px 14px"},MenuProps:{PaperProps:{style:{borderRadius:10,boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.08)",maxHeight:250}}},sx:{"& .MuiOutlinedInput-notchedOutline":{border:"1px solid #ddd"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#bbb"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#5928ed"}}},{children:[n(dK,M({sx:{fontFamily:"Plus Jakarta Sans"},value:"",disabled:!0},{children:"Choose an option"})),r.map((function(e){return n(dK,M({value:e.value,sx:{fontFamily:"Plus Jakarta Sans",fontWeight:500,fontSize:14,color:"#333","&:hover":{backgroundColor:"#f2f0fe"},"&.Mui-selected":{backgroundColor:"#5928ed !important",color:"#fff"},"&.Mui-selected:hover":{backgroundColor:"#4e23d1 !important"}}},{children:e.label}),e.value)}))]}))]}))},R7=function(t){var r=t.selectedText,a=t.scopeOptions,o=t.devModeTag,d=t.chatLogo,u=void 0===d?null:d,m=t.submitFunction;t.setShowChat,t.showChat;var p=t.setFormDataState,v=t.instantLearningSuggestions;t.setHasUserFilledForm,t.hasUserFilledForm;var f=t.isNewChatClicked,z=t.setIsNewChatClicked,g=t.setHasUserWrittenModification,y=t.extractedModification,E=t.save,b=t.extractedTooltip;t.isSaveLoading,t.template;var H=t.userQuery,C=t.templateOptions,L=t.topic,k=c({context:"",issue_with_response:"",original:null!=r?r:"",modification:"",whenToApply:"",whenNotToApply:"",tooltip:"",scope:a[0].value,isTooltipEnabled:!1,isModificationEnabled:!0,isDevMode:!1,userQuery:H||"",howToRespond:"",topic:L}),w=k[0],S=k[1],x=c(!1),T=x[0],O=x[1],A=c(!1),R=A[0],N=A[1],_=c(!1),D=_[0],P=_[1],F=c(!1);F[0];var I=F[1],B=c(""),j=B[0],U=B[1],W=c("");W[0],W[1];var $=c([]),q=$[0],G=$[1],Y=c([]),K=Y[0],X=Y[1],Q=c(!1),J=Q[0],Z=Q[1],ee=c(!1),te=ee[0],ne=ee[1],re=c(!1),ae=re[0],oe=re[1],ce=h((function(){var e,t;return""!==(null===(e=null==w?void 0:w.userQuery)||void 0===e?void 0:e.trim())&&""!==(null===(t=null==w?void 0:w.howToRespond)||void 0===t?void 0:t.trim())}),[w,q,v]);i(null),s((function(){S((function(e){return M(M({},e),{howToRespond:"".concat(j)})}))}),[j]),s((function(){if(""===y&&(null==w?void 0:w.isTooltipEnabled)&&S((function(e){return M(M({},e),{isModificationEnabled:!1})})),""!==y||(null==w?void 0:w.isTooltipEnabled)||S((function(e){return M(M({},e),{modification:""})})),y&&""!==y){S((function(e){return M(M({},e),{modification:y,isModificationEnabled:!0})})),I(!0);var e=setTimeout((function(){I(!1)}),400);return function(){return clearTimeout(e)}}}),[y]),s((function(){""===b&&S((function(e){return M(M({},e),{isTooltipEnabled:!1})})),b&&""!==b&&S((function(e){return M(M({},e),{tooltip:b,isTooltipEnabled:!0})}))}),[b]),s((function(){f&&(S((function(e){return M(M({},e),{modification:"",tooltip:"",isTooltipEnabled:!1,isModificationEnabled:!0})})),G([]),X([]),z(!1))}),[f]),s((function(){p(w)}),[w]),s((function(){""===w.original.trim()||""===w.modification.trim()&&""===w.tooltip.trim()||T||O(!0)}),[w]),s((function(){if((null==q?void 0:q.length)>0&&!J){N(!0);var e=setTimeout((function(){N(!1)}),400);return function(){return clearTimeout(e)}}}),[JSON.stringify(q)]),s((function(){if((null==K?void 0:K.length)>0&&!te){P(!0);var e=setTimeout((function(){P(!1)}),400);return function(){return clearTimeout(e)}}}),[JSON.stringify(K)]),s((function(){var e,t,n,r;if(v){Z(!1),ne(!1);var a=null===(e=null==v?void 0:v.conditions_whentoapply)||void 0===e?void 0:e.map((function(e){return e.when_to_apply})),o=null===(t=null==v?void 0:v.conditions_whennottoapply)||void 0===t?void 0:t.map((function(e){return e.when_not_to_apply}));(null===(n=null==v?void 0:v.conditions_whentoapply)||void 0===n?void 0:n.length)&&(G(a),S((function(e){return M(M({},e),{whenToApply:null==a?void 0:a.join(" OR ")})}))),(null===(r=null==v?void 0:v.conditions_whennottoapply)||void 0===r?void 0:r.length)&&(X(o),S((function(e){return M(M({},e),{whenNotToApply:null==o?void 0:o.join(" OR ")})})))}}),[v]);var ie=i(null),le=l((function(){ie.current&&clearTimeout(ie.current),ie.current=setTimeout((function(){g(!0)}),1e3)}),[]),se=l((function(e){return function(t){S((function(n){var r;return M(M({},n),((r={})[e]=t.target.value,r))})),le()}}),[le]);l((function(e){var t=e.replace(new RegExp("<".concat(o,">"),"gi"),"").replace(new RegExp("</".concat(o,">"),"gi"),"").replace(/<\/?[^>]+(>|$)/g,"");S((function(e){return M(M({},e),{tooltip:t})})),le()}),[le]);var he,de=function(){console.log("Form submitted:",w),oe(!0),""===(null==w?void 0:w.modification)&&S((function(e){return M(M({},e),{isModificationEnabled:!1})})),""===(null==w?void 0:w.tooltip)&&S((function(e){return M(M({},e),{isTooltipEnabled:!1})})),m(w,oe)};return s((function(){E&&de()}),[E]),e(Yj,M({p:0,className:j8,sx:{display:"flex",flexDirection:"column",height:"100%",width:"100%"}},{children:[n(Yj,{children:n(iF,M({sx:{fontSize:20,fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:"Instant Learning"}))}),e(Yj,M({sx:{fontFamily:"Plus Jakarta Sans",display:"flex",flexDirection:"column",gap:2,justifyContent:"space-between",flexGrow:1,paddingTop:"20px",height:"calc(100% - 30px)",overflow:"hidden"}},{children:[e(Yj,M({sx:{display:"flex",flexDirection:"column",gap:"20px",height:"calc(100% - 90px)",overflow:"hidden"}},{children:[n(Yj,M({sx:{display:"flex",gap:1}},{children:e(Yj,M({sx:{flex:1}},{children:[e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[e(iF,M({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center"}},{children:["User Query"," ",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"}))]})),n(YZ,{sx:{visibility:"hidden"},disabled:!0})]})),n(j2,{sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}},id:"original",value:w.userQuery,onChange:se("userQuery"),fullWidth:!0,placeholder:"Enter your query"})]}))})),n(A7,{options:C,setSelectedTemplate:U}),e(Yj,M({sx:{display:"flex",gap:2,height:"".concat(w.isTooltipEnabled?"calc(100% - 248px)":"calc(100% - 200px)")}},{children:[!(null==q?void 0:q.length)&&e(Yj,M({sx:{flex:1}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When To Apply",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Specific situations or conditions where this learning should be applied.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 84px)",display:"flex",flexDirection:"column"}},{children:[e("div",M({style:{width:"100%",display:"flex",gap:"0.25rem"}},{children:[e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),n("div",M({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:e("div",M({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[n("div",M({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),e("div",M({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[n("div",M({style:{}},{children:"Tell us about your learning in "})),n("span",M({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",n("span",{children:"Chat"})]}))]}))}))]}))]})),(null==q?void 0:q.length)>0&&e(Yj,M({sx:{flex:1,height:"100%"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans, sans-serif",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When To Apply",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Specific situations or conditions where this learning should be applied.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 84px)",boxShadow:R?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",marginLeft:"4px"}},{children:[e(Yj,M({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:[e(Yj,M({display:"flex",gap:"0.25rem",alignItems:"center"},{children:[u&&n(Yj,{component:"img",src:u,alt:"Chat",sx:{width:14,height:14}}),e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),(null==q?void 0:q.length)>0&&n(LJ,M({title:J?"Save & Lock":"Edit",componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(UP,M({disabled:q.some((function(e){return""===(null==e?void 0:e.trim())})),onClick:function(){return Z((function(e){return!e}))},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:n(J?w7:T7,{fontSize:"small"})}))}))]})),n(Yj,M({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:n("ol",M({style:{paddingLeft:"0rem",fontFamily:"Plus Jakarta Sans",margin:0}},{children:R?e(Yj,M({sx:{display:"flex",justifyContent:"center",py:2,gap:2}},{children:[n(xW,{size:24}),n("span",{children:"Generating When to apply..."})]})):n(Yj,M({sx:{pt:"16px"}},{children:q.map((function(t,r){return e(Yj,M({sx:{display:"flex",alignItems:"flex-start",gap:1,mb:r<q.length-1?2:0,fontFamily:"Plus Jakarta Sans"},component:"li"},{children:[n(j2,{variant:"outlined",disabled:!J,fullWidth:!0,multiline:!0,value:"".concat(t),error:!t.trim(),onChange:function(e){var t=V([],q,!0);t[r]=e.target.value,G(t),S((function(e){return M(M({},e),{whenToApply:t.join(" OR ")})}))},InputProps:{startAdornment:e(VG,M({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[r+1,"."]}))},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}}}),J&&n(UP,M({onClick:function(){if(q.length>1){var e=q.filter((function(e,t){return t!==r}));G(e),S((function(t){return M(M({},t),{whenToApply:e.join(" OR ")})}))}},sx:{mt:1}},{children:n(V7,{})}))]}),r)}))}))}))}))]}))]})),!(null==K?void 0:K.length)&&e(Yj,M({sx:{flex:1}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When Not To Apply",n(LJ,M({title:"Cases where this learning should not be applied to avoid incorrect responses.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,flex:1,display:"flex",flexDirection:"column",height:"calc(100% - 84px)"}},{children:[e("div",M({style:{width:"100%",display:"flex",gap:"0.25rem"}},{children:[e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),n("div",M({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:e("div",M({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[n("div",M({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),e("div",M({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[n("div",M({style:{}},{children:"Tell us about your learning in "})),n("span",M({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",n("span",{children:"Chat"})]}))]}))}))]}))]})),(null==K?void 0:K.length)>0&&e(Yj,M({sx:{flex:1,height:"100%"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When Not To Apply",n(LJ,M({title:"Cases where this learning should not be applied to avoid incorrect responses.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 84px)",boxShadow:D?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",marginRight:"4px"}},{children:[e(Yj,M({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:[e(Yj,M({display:"flex",gap:"0.25rem",alignItems:"center"},{children:[u&&n(Yj,{component:"img",src:u,alt:"Chat",sx:{width:14,height:14}}),e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),(null==K?void 0:K.length)>0&&n(LJ,M({placement:"top",arrow:!0,title:te?"Save & Lock":"Edit",componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(UP,M({disabled:K.some((function(e){return""===(null==e?void 0:e.trim())})),onClick:function(){return ne((function(e){return!e}))},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:n(te?w7:T7,{fontSize:"small"})}))}))]})),n(Yj,M({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:n("ol",M({style:{paddingLeft:"0rem",margin:0}},{children:D?e(Yj,M({sx:{display:"flex",justifyContent:"center",py:2,gap:2}},{children:[n(xW,{size:24}),n("span",{children:"Generating When not to apply..."})]})):n(Yj,M({sx:{pt:"16px"}},{children:K.map((function(t,r){return e(Yj,M({sx:{display:"flex",alignItems:"flex-start",gap:1,mb:r<K.length-1?2:0},component:"li"},{children:[n(j2,{variant:"outlined",disabled:!te,fullWidth:!0,multiline:!0,value:"".concat(t),error:!t.trim(),onChange:function(e){var t=V([],K,!0);t[r]=e.target.value,X(t),S((function(e){return M(M({},e),{whenNotToApply:t.join(" OR ")})}))},InputProps:{startAdornment:e(VG,M({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[r+1,"."]}))},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}}}),te&&n(UP,M({onClick:function(){if(K.length>1){var e=K.filter((function(e,t){return t!==r}));X(e),S((function(t){return M(M({},t),{whenNotToApply:e.join(" OR ")})}))}},disabled:1===K.length,sx:{mt:1}},{children:n(V7,{})}))]}),r)}))}))}))}))]}))]}))]}))]})),e(Yj,M({sx:{display:"flex",gap:2}},{children:[e(Yj,M({sx:{flex:1}},{children:[n(iF,M({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"},gutterBottom:!0},{children:"Scope"})),n(tq,M({sx:{width:"50%",fontFamily:"Plus Jakarta Sans"},variant:"outlined"},{children:e(iQ,M({id:"scope",value:w.scope,onChange:(he="scope",function(e){S((function(t){var n;return M(M({},t),((n={})[he]=e.target.value,n))}))}),displayEmpty:!0,sx:{fontFamily:"Plus Jakarta Sans"},fullWidth:!0},{children:[n(dK,M({value:"",disabled:!0},{children:"Select scope"})),a.map((function(e,t){return n(dK,M({value:e.value,sx:{fontFamily:"Plus Jakarta Sans"}},{children:e.labelText}),t)}))]}))}))]})),n(Yj,M({sx:{flex:1,display:"flex",alignItems:"flex-end",justifyContent:"flex-end"}},{children:e(zU,M({variant:"contained",onClick:de,sx:{width:"30%",height:"56px",fontFamily:"Plus Jakarta Sans",backgroundColor:"green",textTransform:"capitalize","&:hover":{backgroundColor:"#006400"}},disabled:!ce},{children:[ae&&n(xW,{sx:{marginRight:"8px",color:"#fff"},size:16}),ae?"Saving":"Save"]}))}))]}))]}))]}))},N7=function(r){var a=r.open,o=r.selectedText,i=r.scopeOptions,l=r.devModeTag,s=r.submitFunction,h=r.chatAssistantName,d=r.organizationName,u=r.baseUrl,m=r.baseWebsocketUrl,p=r.chatAssistantLogoUrl,v=r.ChatIconComponent,f=r.ggcAssistantName,z=r.closeFunction,g=r.ThinkingBulbIconComponent,y=r.template,E=void 0===y?"":y,b=r.userQuery,H=void 0===b?"":b,V=r.topic,C=void 0===V?"":V,L=r.templateOptions,k=void 0===L?[]:L,w=c(a),S=w[0],x=w[1],T=c(!1),O=T[0],A=T[1],R=c(!1),N=R[0],_=R[1],D=c({}),P=D[0],F=D[1],I=c(null),B=I[0],j=I[1],U=c(!1),W=U[0],$=U[1],q=c(!1),G=q[0],Y=q[1],K=c(null),X=K[0],Q=K[1],J=c(""),Z=J[0],ee=J[1],te=c(!1),ne=te[0],re=te[1],ae=c(!1),oe=ae[0],ce=ae[1],ie=function(){x(!1),z()};return n(t,{children:e(a$,M({open:S,onClose:ie,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:"95vw",height:"100vh",display:"flex",flexDirection:"column",margin:0,maxWidth:"100vw"}}},{children:[n(UP,M({"aria-label":"close",onClick:ie,sx:{position:"absolute",right:8,top:8,zIndex:1,color:function(e){return e.palette.grey[500]}}},{children:n("svg",M({width:"28px",height:"28px",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"#000000"},{children:n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.707.708L7.293 8l-3.646 3.646.707.708L8 8.707z"})}))})),e(p$,M({sx:{flex:1,overflow:"auto",display:"flex",flexDirection:"row",gap:2}},{children:[n(Yj,M({sx:{minWidth:"350px",maxWidth:"35%",bgcolor:"#f5f5f5",p:0,borderRadius:1,display:"flex",flexDirection:"column"}},{children:n(d7,{chatAssistantLogoUrl:p||"",chatAssistantName:h,organizationName:d,baseUrl:u,setInstantLearningSuggestions:F,formDataState:B,hasUserFilledForm:N,setHasUserFilledForm:_,baseWebsocketUrl:m,setIsNewChatClicked:$,selectedText:o,ChatIconComponent:v,ggcAssistantName:f||"",ThinkingBulbIconComponent:g,hasUserWrittenModification:G,setExtractedModification:Q,setSave:re,setExtractedTooltip:ee,setIsSaveLoading:ce,isSaveLoading:oe,save:ne,instantLearningSuggestions:P,template:E})})),n(Yj,M({sx:{minWidth:"65%",maxWidth:"65%",display:"flex",flexDirection:"column"}},{children:"TemplateRetrieval"===E?n(R7,{selectedText:o,scopeOptions:i||[],devModeTag:l||"",submitFunction:s,setShowChat:A,showChat:O,setFormDataState:j,instantLearningSuggestions:P,setHasUserFilledForm:_,hasUserFilledForm:N,isNewChatClicked:W,setIsNewChatClicked:$,setHasUserWrittenModification:Y,extractedModification:X,save:ne,extractedTooltip:Z,isSaveLoading:oe,template:E,userQuery:H,templateOptions:k,topic:C}):n(O7,{selectedText:o,scopeOptions:i||[],devModeTag:l||"",submitFunction:s,setShowChat:A,showChat:O,setFormDataState:j,instantLearningSuggestions:P,setHasUserFilledForm:_,hasUserFilledForm:N,isNewChatClicked:W,setIsNewChatClicked:$,setHasUserWrittenModification:Y,extractedModification:X,save:ne,extractedTooltip:Z,isSaveLoading:oe})}))]}))]}))})},_7="PdfEditorCitation-module_citationRoot__5OtUI",D7="PdfEditorCitation-module_citationTitle__X9kQm",P7="PdfEditorCitation-module_citationBody__C99jX",F7="PdfEditorCitation-module_citationBodyWhenCollapsed__8vG0V";C(".PdfEditorCitation-module_citationRoot__5OtUI{display:flex;flex-direction:column}.PdfEditorCitation-module_citationTitle__X9kQm{align-items:center;background-color:#eff6ff;border:1px solid #000;border-radius:10px;cursor:pointer;display:inline-flex;gap:10px;padding:5px 8px;width:fit-content}.PdfEditorCitation-module_citationBody__C99jX{background-color:#fff;flex-grow:1}.PdfEditorCitation-module_citationBodyWhenCollapsed__8vG0V{display:none}.PdfEditorCitation-module_citationBodyWhenFullScreen__VKtop{bottom:0;height:100%!important;left:0;max-height:100%;position:absolute;right:0;top:0;width:100%!important}");var I7,B7={};var j7,U7=function(){if(I7)return B7;I7=1;var e=p_(),t=f7();Object.defineProperty(B7,"__esModule",{value:!0}),B7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");return B7.default=r,B7}(),W7=xe(U7),$7={};var q7=function(){if(j7)return $7;j7=1;var e=p_(),t=f7();Object.defineProperty($7,"__esModule",{value:!0}),$7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore");return $7.default=r,$7}(),G7=xe(q7),Y7=function(){return Y7=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Y7.apply(this,arguments)};function K7(e,t,n,r){return new(n||(n=Promise))((function(a,o){function c(e){try{l(r.next(e))}catch(e){o(e)}}function i(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?a(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(c,i)}l((r=r.apply(e,t||[])).next())}))}function X7(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=i(0),c.throw=i(1),c.return=i(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function i(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c&&(c=0,i[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function Q7(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var J7=void 0!==ot?ot:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Z7(){throw new Error("setTimeout has not been defined")}function eee(){throw new Error("clearTimeout has not been defined")}var tee=Z7,nee=eee;function ree(e){if(tee===setTimeout)return setTimeout(e,0);if((tee===Z7||!tee)&&setTimeout)return tee=setTimeout,setTimeout(e,0);try{return tee(e,0)}catch(t){try{return tee.call(null,e,0)}catch(t){return tee.call(this,e,0)}}}"function"==typeof J7.setTimeout&&(tee=setTimeout),"function"==typeof J7.clearTimeout&&(nee=clearTimeout);var aee,oee=[],cee=!1,iee=-1;function lee(){cee&&aee&&(cee=!1,aee.length?oee=aee.concat(oee):iee=-1,oee.length&&see())}function see(){if(!cee){var e=ree(lee);cee=!0;for(var t=oee.length;t;){for(aee=oee,oee=[];++iee<t;)aee&&aee[iee].run();iee=-1,t=oee.length}aee=null,cee=!1,function(e){if(nee===clearTimeout)return clearTimeout(e);if((nee===eee||!nee)&&clearTimeout)return nee=clearTimeout,clearTimeout(e);try{return nee(e)}catch(t){try{return nee.call(null,e)}catch(t){return nee.call(this,e)}}}(e)}}function hee(e,t){this.fun=e,this.array=t}function dee(){}hee.prototype.run=function(){this.fun.apply(null,this.array)};var uee=dee,mee=dee,pee=dee,vee=dee,fee=dee,zee=dee,gee=dee,yee=J7.performance||{},Mee=yee.now||yee.mozNow||yee.msNow||yee.oNow||yee.webkitNow||function(){return(new Date).getTime()},Eee=new Date,bee={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];oee.push(new hee(e,t)),1!==oee.length||cee||ree(see)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:uee,addListener:mee,once:pee,off:vee,removeListener:fee,removeAllListeners:zee,emit:gee,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Mee.call(yee),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Eee)/1e3}};function Hee(e,t){return function(){return e.apply(t,arguments)}}const{toString:Vee}=Object.prototype,{getPrototypeOf:Cee}=Object,Lee=(Tee=Object.create(null),e=>{const t=Vee.call(e);return Tee[t]||(Tee[t]=t.slice(8,-1).toLowerCase())}),kee=e=>(e=e.toLowerCase(),t=>Lee(t)===e),wee=e=>t=>typeof t===e,{isArray:See}=Array,xee=wee("undefined");var Tee;const Oee=kee("ArrayBuffer"),Aee=wee("string"),Ree=wee("function"),Nee=wee("number"),_ee=e=>null!==e&&"object"==typeof e,Dee=e=>{if("object"!==Lee(e))return!1;const t=Cee(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Pee=kee("Date"),Fee=kee("File"),Iee=kee("Blob"),Bee=kee("FileList"),jee=kee("URLSearchParams"),[Uee,Wee,$ee,qee]=["ReadableStream","Request","Response","Headers"].map(kee);function Gee(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,a;if("object"!=typeof e&&(e=[e]),See(e))for(r=0,a=e.length;r<a;r++)t.call(null,e[r],r,e);else{const a=n?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let c;for(r=0;r<o;r++)c=a[r],t.call(null,e[c],c,e)}}function Yee(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,a=n.length;for(;a-- >0;)if(r=n[a],t===r.toLowerCase())return r;return null}const Kee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:J7,Xee=e=>!xee(e)&&e!==Kee,Qee=(Jee="undefined"!=typeof Uint8Array&&Cee(Uint8Array),e=>Jee&&e instanceof Jee);var Jee;const Zee=kee("HTMLFormElement"),ete=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),tte=kee("RegExp"),nte=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Gee(n,((n,a)=>{let o;!1!==(o=t(n,a,e))&&(r[a]=o||n)})),Object.defineProperties(e,r)},rte="abcdefghijklmnopqrstuvwxyz",ate="0123456789",ote={DIGIT:ate,ALPHA:rte,ALPHA_DIGIT:rte+rte.toUpperCase()+ate},cte=kee("AsyncFunction"),ite=(lte="function"==typeof setImmediate,ste=Ree(Kee.postMessage),lte?setImmediate:ste?(hte=`axios@${Math.random()}`,dte=[],Kee.addEventListener("message",(({source:e,data:t})=>{e===Kee&&t===hte&&dte.length&&dte.shift()()}),!1),e=>{dte.push(e),Kee.postMessage(hte,"*")}):e=>setTimeout(e));var lte,ste,hte,dte;const ute="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Kee):bee.nextTick||ite;var mte={isArray:See,isArrayBuffer:Oee,isBuffer:function(e){return null!==e&&!xee(e)&&null!==e.constructor&&!xee(e.constructor)&&Ree(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ree(e.append)&&("formdata"===(t=Lee(e))||"object"===t&&Ree(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Oee(e.buffer),t},isString:Aee,isNumber:Nee,isBoolean:e=>!0===e||!1===e,isObject:_ee,isPlainObject:Dee,isReadableStream:Uee,isRequest:Wee,isResponse:$ee,isHeaders:qee,isUndefined:xee,isDate:Pee,isFile:Fee,isBlob:Iee,isRegExp:tte,isFunction:Ree,isStream:e=>_ee(e)&&Ree(e.pipe),isURLSearchParams:jee,isTypedArray:Qee,isFileList:Bee,forEach:Gee,merge:function e(){const{caseless:t}=Xee(this)&&this||{},n={},r=(r,a)=>{const o=t&&Yee(n,a)||a;Dee(n[o])&&Dee(r)?n[o]=e(n[o],r):Dee(r)?n[o]=e({},r):See(r)?n[o]=r.slice():n[o]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Gee(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(Gee(t,((t,r)=>{n&&Ree(t)?e[r]=Hee(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let a,o,c;const i={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)c=a[o],r&&!r(c,e,t)||i[c]||(t[c]=e[c],i[c]=!0);e=!1!==n&&Cee(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Lee,kindOfTest:kee,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(See(e))return e;let t=e.length;if(!Nee(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:Zee,hasOwnProperty:ete,hasOwnProp:ete,reduceDescriptors:nte,freezeMethods:e=>{nte(e,((t,n)=>{if(Ree(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Ree(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return See(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Yee,global:Kee,isContextDefined:Xee,ALPHABET:ote,generateString:(e=16,t=ote.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&Ree(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(_ee(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const a=See(e)?[]:{};return Gee(e,((e,t)=>{const o=n(e,r+1);!xee(o)&&(a[t]=o)})),t[r]=void 0,a}}return e};return n(e,0)},isAsyncFn:cte,isThenable:e=>e&&(_ee(e)||Ree(e))&&Ree(e.then)&&Ree(e.catch),setImmediate:ite,asap:ute},pte=[],vte=[],fte="undefined"!=typeof Uint8Array?Uint8Array:Array,zte=!1;function gte(){zte=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)pte[t]=e[t],vte[e.charCodeAt(t)]=t;vte["-".charCodeAt(0)]=62,vte["_".charCodeAt(0)]=63}function yte(e,t,n){for(var r,a,o=[],c=t;c<n;c+=3)r=(e[c]<<16)+(e[c+1]<<8)+e[c+2],o.push(pte[(a=r)>>18&63]+pte[a>>12&63]+pte[a>>6&63]+pte[63&a]);return o.join("")}function Mte(e){var t;zte||gte();for(var n=e.length,r=n%3,a="",o=[],c=16383,i=0,l=n-r;i<l;i+=c)o.push(yte(e,i,i+c>l?l:i+c));return 1===r?(t=e[n-1],a+=pte[t>>2],a+=pte[t<<4&63],a+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],a+=pte[t>>10],a+=pte[t>>4&63],a+=pte[t<<2&63],a+="="),o.push(a),o.join("")}function Ete(e,t,n,r,a){var o,c,i=8*a-r-1,l=(1<<i)-1,s=l>>1,h=-7,d=n?a-1:0,u=n?-1:1,m=e[t+d];for(d+=u,o=m&(1<<-h)-1,m>>=-h,h+=i;h>0;o=256*o+e[t+d],d+=u,h-=8);for(c=o&(1<<-h)-1,o>>=-h,h+=r;h>0;c=256*c+e[t+d],d+=u,h-=8);if(0===o)o=1-s;else{if(o===l)return c?NaN:1/0*(m?-1:1);c+=Math.pow(2,r),o-=s}return(m?-1:1)*c*Math.pow(2,o-r)}function bte(e,t,n,r,a,o){var c,i,l,s=8*o-a-1,h=(1<<s)-1,d=h>>1,u=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,c=h):(c=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-c))<1&&(c--,l*=2),(t+=c+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(c++,l/=2),c+d>=h?(i=0,c=h):c+d>=1?(i=(t*l-1)*Math.pow(2,a),c+=d):(i=t*Math.pow(2,d-1)*Math.pow(2,a),c=0));a>=8;e[n+m]=255&i,m+=p,i/=256,a-=8);for(c=c<<a|i,s+=a;s>0;e[n+m]=255&c,m+=p,c/=256,s-=8);e[n+m-p]|=128*v}var Hte={}.toString,Vte=Array.isArray||function(e){return"[object Array]"==Hte.call(e)};function Cte(){return kte.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Lte(e,t){if(Cte()<t)throw new RangeError("Invalid typed array length");return kte.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=kte.prototype:(null===e&&(e=new kte(t)),e.length=t),e}function kte(e,t,n){if(!(kte.TYPED_ARRAY_SUPPORT||this instanceof kte))return new kte(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return xte(this,e)}return wte(this,e,t,n)}function wte(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),kte.TYPED_ARRAY_SUPPORT?(e=t).__proto__=kte.prototype:e=Tte(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!kte.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Rte(t,n),a=(e=Lte(e,r)).write(t,n);return a!==r&&(e=e.slice(0,a)),e}(e,t,n):function(e,t){if(Ate(t)){var n=0|Ote(t.length);return 0===(e=Lte(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?Lte(e,0):Tte(e,t);if("Buffer"===t.type&&Vte(t.data))return Tte(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Ste(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function xte(e,t){if(Ste(t),e=Lte(e,t<0?0:0|Ote(t)),!kte.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Tte(e,t){var n=t.length<0?0:0|Ote(t.length);e=Lte(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Ote(e){if(e>=Cte())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Cte().toString(16)+" bytes");return 0|e}function Ate(e){return!(null==e||!e._isBuffer)}function Rte(e,t){if(Ate(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ine(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return lne(e).length;default:if(r)return ine(e).length;t=(""+t).toLowerCase(),r=!0}}function Nte(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Xte(this,t,n);case"utf8":case"utf-8":return qte(this,t,n);case"ascii":return Yte(this,t,n);case"latin1":case"binary":return Kte(this,t,n);case"base64":return $te(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qte(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function _te(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Dte(e,t,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof t&&(t=kte.from(t,r)),Ate(t))return 0===t.length?-1:Pte(e,t,n,r,a);if("number"==typeof t)return t&=255,kte.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Pte(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function Pte(e,t,n,r,a){var o,c=1,i=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;c=2,i/=2,l/=2,n/=2}function s(e,t){return 1===c?e[t]:e.readUInt16BE(t*c)}if(a){var h=-1;for(o=n;o<i;o++)if(s(e,o)===s(t,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===l)return h*c}else-1!==h&&(o-=o-h),h=-1}else for(n+l>i&&(n=i-l),o=n;o>=0;o--){for(var d=!0,u=0;u<l;u++)if(s(e,o+u)!==s(t,u)){d=!1;break}if(d)return o}return-1}function Fte(e,t,n,r){n=Number(n)||0;var a=e.length-n;r?(r=Number(r))>a&&(r=a):r=a;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var c=0;c<r;++c){var i=parseInt(t.substr(2*c,2),16);if(isNaN(i))return c;e[n+c]=i}return c}function Ite(e,t,n,r){return sne(ine(t,e.length-n),e,n,r)}function Bte(e,t,n,r){return sne(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function jte(e,t,n,r){return Bte(e,t,n,r)}function Ute(e,t,n,r){return sne(lne(t),e,n,r)}function Wte(e,t,n,r){return sne(function(e,t){for(var n,r,a,o=[],c=0;c<e.length&&!((t-=2)<0);++c)r=(n=e.charCodeAt(c))>>8,a=n%256,o.push(a),o.push(r);return o}(t,e.length-n),e,n,r)}function $te(e,t,n){return 0===t&&n===e.length?Mte(e):Mte(e.slice(t,n))}function qte(e,t,n){n=Math.min(e.length,n);for(var r=[],a=t;a<n;){var o,c,i,l,s=e[a],h=null,d=s>239?4:s>223?3:s>191?2:1;if(a+d<=n)switch(d){case 1:s<128&&(h=s);break;case 2:128==(192&(o=e[a+1]))&&(l=(31&s)<<6|63&o)>127&&(h=l);break;case 3:o=e[a+1],c=e[a+2],128==(192&o)&&128==(192&c)&&(l=(15&s)<<12|(63&o)<<6|63&c)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:o=e[a+1],c=e[a+2],i=e[a+3],128==(192&o)&&128==(192&c)&&128==(192&i)&&(l=(15&s)<<18|(63&o)<<12|(63&c)<<6|63&i)>65535&&l<1114112&&(h=l)}null===h?(h=65533,d=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),a+=d}return function(e){var t=e.length;if(t<=Gte)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Gte));return n}(r)}kte.TYPED_ARRAY_SUPPORT=void 0===J7.TYPED_ARRAY_SUPPORT||J7.TYPED_ARRAY_SUPPORT,Cte(),kte.poolSize=8192,kte._augment=function(e){return e.__proto__=kte.prototype,e},kte.from=function(e,t,n){return wte(null,e,t,n)},kte.TYPED_ARRAY_SUPPORT&&(kte.prototype.__proto__=Uint8Array.prototype,kte.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&kte[Symbol.species]),kte.alloc=function(e,t,n){return function(e,t,n,r){return Ste(t),t<=0?Lte(e,t):void 0!==n?"string"==typeof r?Lte(e,t).fill(n,r):Lte(e,t).fill(n):Lte(e,t)}(null,e,t,n)},kte.allocUnsafe=function(e){return xte(null,e)},kte.allocUnsafeSlow=function(e){return xte(null,e)},kte.isBuffer=function(e){return null!=e&&(!!e._isBuffer||hne(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&hne(e.slice(0,0))}(e))},kte.compare=function(e,t){if(!Ate(e)||!Ate(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,a=0,o=Math.min(n,r);a<o;++a)if(e[a]!==t[a]){n=e[a],r=t[a];break}return n<r?-1:r<n?1:0},kte.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},kte.concat=function(e,t){if(!Vte(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return kte.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=kte.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){var o=e[n];if(!Ate(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,a),a+=o.length}return r},kte.byteLength=Rte,kte.prototype._isBuffer=!0,kte.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)_te(this,t,t+1);return this},kte.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)_te(this,t,t+3),_te(this,t+1,t+2);return this},kte.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)_te(this,t,t+7),_te(this,t+1,t+6),_te(this,t+2,t+5),_te(this,t+3,t+4);return this},kte.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?qte(this,0,e):Nte.apply(this,arguments)},kte.prototype.equals=function(e){if(!Ate(e))throw new TypeError("Argument must be a Buffer");return this===e||0===kte.compare(this,e)},kte.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},kte.prototype.compare=function(e,t,n,r,a){if(!Ate(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===a&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(a>>>=0)-(r>>>=0),c=(n>>>=0)-(t>>>=0),i=Math.min(o,c),l=this.slice(r,a),s=e.slice(t,n),h=0;h<i;++h)if(l[h]!==s[h]){o=l[h],c=s[h];break}return o<c?-1:c<o?1:0},kte.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},kte.prototype.indexOf=function(e,t,n){return Dte(this,e,t,n,!0)},kte.prototype.lastIndexOf=function(e,t,n){return Dte(this,e,t,n,!1)},kte.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var a=this.length-t;if((void 0===n||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return Fte(this,e,t,n);case"utf8":case"utf-8":return Ite(this,e,t,n);case"ascii":return Bte(this,e,t,n);case"latin1":case"binary":return jte(this,e,t,n);case"base64":return Ute(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wte(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},kte.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Gte=4096;function Yte(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;a<n;++a)r+=String.fromCharCode(127&e[a]);return r}function Kte(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;a<n;++a)r+=String.fromCharCode(e[a]);return r}function Xte(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var a="",o=t;o<n;++o)a+=cne(e[o]);return a}function Qte(e,t,n){for(var r=e.slice(t,n),a="",o=0;o<r.length;o+=2)a+=String.fromCharCode(r[o]+256*r[o+1]);return a}function Jte(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function Zte(e,t,n,r,a,o){if(!Ate(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function ene(e,t,n,r){t<0&&(t=65535+t+1);for(var a=0,o=Math.min(e.length-n,2);a<o;++a)e[n+a]=(t&255<<8*(r?a:1-a))>>>8*(r?a:1-a)}function tne(e,t,n,r){t<0&&(t=4294967295+t+1);for(var a=0,o=Math.min(e.length-n,4);a<o;++a)e[n+a]=t>>>8*(r?a:3-a)&255}function nne(e,t,n,r,a,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function rne(e,t,n,r,a){return a||nne(e,0,n,4),bte(e,t,n,r,23,4),n+4}function ane(e,t,n,r,a){return a||nne(e,0,n,8),bte(e,t,n,r,52,8),n+8}kte.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),kte.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=kte.prototype;else{var a=t-e;n=new kte(a,void 0);for(var o=0;o<a;++o)n[o]=this[o+e]}return n},kte.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Jte(e,t,this.length);for(var r=this[e],a=1,o=0;++o<t&&(a*=256);)r+=this[e+o]*a;return r},kte.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Jte(e,t,this.length);for(var r=this[e+--t],a=1;t>0&&(a*=256);)r+=this[e+--t]*a;return r},kte.prototype.readUInt8=function(e,t){return t||Jte(e,1,this.length),this[e]},kte.prototype.readUInt16LE=function(e,t){return t||Jte(e,2,this.length),this[e]|this[e+1]<<8},kte.prototype.readUInt16BE=function(e,t){return t||Jte(e,2,this.length),this[e]<<8|this[e+1]},kte.prototype.readUInt32LE=function(e,t){return t||Jte(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},kte.prototype.readUInt32BE=function(e,t){return t||Jte(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},kte.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Jte(e,t,this.length);for(var r=this[e],a=1,o=0;++o<t&&(a*=256);)r+=this[e+o]*a;return r>=(a*=128)&&(r-=Math.pow(2,8*t)),r},kte.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Jte(e,t,this.length);for(var r=t,a=1,o=this[e+--r];r>0&&(a*=256);)o+=this[e+--r]*a;return o>=(a*=128)&&(o-=Math.pow(2,8*t)),o},kte.prototype.readInt8=function(e,t){return t||Jte(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},kte.prototype.readInt16LE=function(e,t){t||Jte(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},kte.prototype.readInt16BE=function(e,t){t||Jte(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},kte.prototype.readInt32LE=function(e,t){return t||Jte(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},kte.prototype.readInt32BE=function(e,t){return t||Jte(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},kte.prototype.readFloatLE=function(e,t){return t||Jte(e,4,this.length),Ete(this,e,!0,23,4)},kte.prototype.readFloatBE=function(e,t){return t||Jte(e,4,this.length),Ete(this,e,!1,23,4)},kte.prototype.readDoubleLE=function(e,t){return t||Jte(e,8,this.length),Ete(this,e,!0,52,8)},kte.prototype.readDoubleBE=function(e,t){return t||Jte(e,8,this.length),Ete(this,e,!1,52,8)},kte.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||Zte(this,e,t,n,Math.pow(2,8*n)-1,0);var a=1,o=0;for(this[t]=255&e;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},kte.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||Zte(this,e,t,n,Math.pow(2,8*n)-1,0);var a=n-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},kte.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,1,255,0),kte.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},kte.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,2,65535,0),kte.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ene(this,e,t,!0),t+2},kte.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,2,65535,0),kte.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ene(this,e,t,!1),t+2},kte.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,4,4294967295,0),kte.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):tne(this,e,t,!0),t+4},kte.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,4,4294967295,0),kte.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):tne(this,e,t,!1),t+4},kte.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);Zte(this,e,t,n,a-1,-a)}var o=0,c=1,i=0;for(this[t]=255&e;++o<n&&(c*=256);)e<0&&0===i&&0!==this[t+o-1]&&(i=1),this[t+o]=(e/c|0)-i&255;return t+n},kte.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);Zte(this,e,t,n,a-1,-a)}var o=n-1,c=1,i=0;for(this[t+o]=255&e;--o>=0&&(c*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/c|0)-i&255;return t+n},kte.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,1,127,-128),kte.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},kte.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,2,32767,-32768),kte.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ene(this,e,t,!0),t+2},kte.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,2,32767,-32768),kte.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ene(this,e,t,!1),t+2},kte.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,4,2147483647,-2147483648),kte.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):tne(this,e,t,!0),t+4},kte.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),kte.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):tne(this,e,t,!1),t+4},kte.prototype.writeFloatLE=function(e,t,n){return rne(this,e,t,!0,n)},kte.prototype.writeFloatBE=function(e,t,n){return rne(this,e,t,!1,n)},kte.prototype.writeDoubleLE=function(e,t,n){return ane(this,e,t,!0,n)},kte.prototype.writeDoubleBE=function(e,t,n){return ane(this,e,t,!1,n)},kte.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var a,o=r-n;if(this===e&&n<t&&t<r)for(a=o-1;a>=0;--a)e[a+t]=this[a+n];else if(o<1e3||!kte.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},kte.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var a=e.charCodeAt(0);a<256&&(e=a)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!kte.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var c=Ate(e)?e:ine(new kte(e,r).toString()),i=c.length;for(o=0;o<n-t;++o)this[o+t]=c[o%i]}return this};var one=/[^+\/0-9A-Za-z-_]/g;function cne(e){return e<16?"0"+e.toString(16):e.toString(16)}function ine(e,t){var n;t=t||1/0;for(var r=e.length,a=null,o=[],c=0;c<r;++c){if((n=e.charCodeAt(c))>55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(c+1===r){(t-=3)>-1&&o.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&o.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function lne(e){return function(e){var t,n,r,a,o,c;zte||gte();var i=e.length;if(i%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[i-2]?2:"="===e[i-1]?1:0,c=new fte(3*i/4-o),r=o>0?i-4:i;var l=0;for(t=0,n=0;t<r;t+=4,n+=3)a=vte[e.charCodeAt(t)]<<18|vte[e.charCodeAt(t+1)]<<12|vte[e.charCodeAt(t+2)]<<6|vte[e.charCodeAt(t+3)],c[l++]=a>>16&255,c[l++]=a>>8&255,c[l++]=255&a;return 2===o?(a=vte[e.charCodeAt(t)]<<2|vte[e.charCodeAt(t+1)]>>4,c[l++]=255&a):1===o&&(a=vte[e.charCodeAt(t)]<<10|vte[e.charCodeAt(t+1)]<<4|vte[e.charCodeAt(t+2)]>>2,c[l++]=a>>8&255,c[l++]=255&a),c}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(one,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function sne(e,t,n,r){for(var a=0;a<r&&!(a+n>=t.length||a>=e.length);++a)t[a+n]=e[a];return a}function hne(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function dne(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}mte.inherits(dne,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:mte.toJSONObject(this.config),code:this.code,status:this.status}}});const une=dne.prototype,mne={};function pne(e){return mte.isPlainObject(e)||mte.isArray(e)}function vne(e){return mte.endsWith(e,"[]")?e.slice(0,-2):e}function fne(e,t,n){return e?e.concat(t).map((function(e,t){return e=vne(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{mne[e]={value:e}})),Object.defineProperties(dne,mne),Object.defineProperty(une,"isAxiosError",{value:!0}),dne.from=(e,t,n,r,a,o)=>{const c=Object.create(une);return mte.toFlatObject(e,c,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),dne.call(c,e.message,t,n,r,a),c.cause=e,c.name=e.name,o&&Object.assign(c,o),c};const zne=mte.toFlatObject(mte,{},null,(function(e){return/^is[A-Z]/.test(e)}));function gne(e,t,n){if(!mte.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=mte.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!mte.isUndefined(t[e])}))).metaTokens,a=n.visitor||s,o=n.dots,c=n.indexes,i=(n.Blob||"undefined"!=typeof Blob&&Blob)&&mte.isSpecCompliantForm(t);if(!mte.isFunction(a))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(mte.isDate(e))return e.toISOString();if(!i&&mte.isBlob(e))throw new dne("Blob is not supported. Use a Buffer instead.");return mte.isArrayBuffer(e)||mte.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):kte.from(e):e}function s(e,n,a){let i=e;if(e&&!a&&"object"==typeof e)if(mte.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(mte.isArray(e)&&function(e){return mte.isArray(e)&&!e.some(pne)}(e)||(mte.isFileList(e)||mte.endsWith(n,"[]"))&&(i=mte.toArray(e)))return n=vne(n),i.forEach((function(e,r){!mte.isUndefined(e)&&null!==e&&t.append(!0===c?fne([n],r,o):null===c?n:n+"[]",l(e))})),!1;return!!pne(e)||(t.append(fne(a,n,o),l(e)),!1)}const h=[],d=Object.assign(zne,{defaultVisitor:s,convertValue:l,isVisitable:pne});if(!mte.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!mte.isUndefined(n)){if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),mte.forEach(n,(function(n,o){!0===(!(mte.isUndefined(n)||null===n)&&a.call(t,n,mte.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])})),h.pop()}}(e),t}function yne(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Mne(e,t){this._pairs=[],e&&gne(e,this,t)}const Ene=Mne.prototype;function bne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Hne(e,t,n){if(!t)return e;const r=n&&n.encode||bne;mte.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let o;if(o=a?a(t,n):mte.isURLSearchParams(t)?t.toString():new Mne(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Ene.append=function(e,t){this._pairs.push([e,t])},Ene.toString=function(e){const t=e?function(t){return e.call(this,t,yne)}:yne;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Vne{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){mte.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Cne={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Lne={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Mne,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const kne="undefined"!=typeof window&&"undefined"!=typeof document,wne="object"==typeof navigator&&navigator||void 0,Sne=kne&&(!wne||["ReactNative","NativeScript","NS"].indexOf(wne.product)<0),xne="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Tne=kne&&window.location.href||"http://localhost";var One={...Object.freeze({__proto__:null,hasBrowserEnv:kne,hasStandardBrowserWebWorkerEnv:xne,hasStandardBrowserEnv:Sne,navigator:wne,origin:Tne}),...Lne};function Ane(e){function t(e,n,r,a){let o=e[a++];if("__proto__"===o)return!0;const c=Number.isFinite(+o),i=a>=e.length;return o=!o&&mte.isArray(r)?r.length:o,i?(mte.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!c):(r[o]&&mte.isObject(r[o])||(r[o]=[]),t(e,n,r[o],a)&&mte.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const a=n.length;let o;for(r=0;r<a;r++)o=n[r],t[o]=e[o];return t}(r[o])),!c)}if(mte.isFormData(e)&&mte.isFunction(e.entries)){const n={};return mte.forEachEntry(e,((e,r)=>{t(function(e){return mte.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const Rne={transitional:Cne,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,a=mte.isObject(e);if(a&&mte.isHTMLForm(e)&&(e=new FormData(e)),mte.isFormData(e))return r?JSON.stringify(Ane(e)):e;if(mte.isArrayBuffer(e)||mte.isBuffer(e)||mte.isStream(e)||mte.isFile(e)||mte.isBlob(e)||mte.isReadableStream(e))return e;if(mte.isArrayBufferView(e))return e.buffer;if(mte.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return gne(e,new One.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return One.isNode&&mte.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=mte.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return gne(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||r?(t.setContentType("application/json",!1),function(e){if(mte.isString(e))try{return(0,JSON.parse)(e),mte.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Rne.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(mte.isResponse(e)||mte.isReadableStream(e))return e;if(e&&mte.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw dne.from(e,dne.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:One.classes.FormData,Blob:One.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};mte.forEach(["delete","get","head","post","put","patch"],(e=>{Rne.headers[e]={}}));const Nne=mte.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),_ne=Symbol("internals");function Dne(e){return e&&String(e).trim().toLowerCase()}function Pne(e){return!1===e||null==e?e:mte.isArray(e)?e.map(Pne):String(e)}function Fne(e,t,n,r,a){return mte.isFunction(r)?r.call(this,t,n):(a&&(t=n),mte.isString(t)?mte.isString(r)?-1!==t.indexOf(r):mte.isRegExp(r)?r.test(t):void 0:void 0)}class Ine{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function a(e,t,n){const a=Dne(t);if(!a)throw new Error("header name must be a non-empty string");const o=mte.findKey(r,a);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=Pne(e))}const o=(e,t)=>mte.forEach(e,((e,n)=>a(e,n,t)));if(mte.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(mte.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,a;return e&&e.split("\n").forEach((function(e){a=e.indexOf(":"),n=e.substring(0,a).trim().toLowerCase(),r=e.substring(a+1).trim(),!n||t[n]&&Nne[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if(mte.isHeaders(e))for(const[t,r]of e.entries())a(r,t,n);else null!=e&&a(t,e,n);return this}get(e,t){if(e=Dne(e)){const n=mte.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(mte.isFunction(t))return t.call(this,e,n);if(mte.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Dne(e)){const n=mte.findKey(this,e);return!(!n||void 0===this[n]||t&&!Fne(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function a(e){if(e=Dne(e)){const a=mte.findKey(n,e);!a||t&&!Fne(0,n[a],a,t)||(delete n[a],r=!0)}}return mte.isArray(e)?e.forEach(a):a(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const a=t[n];e&&!Fne(0,this[a],a,e,!0)||(delete this[a],r=!0)}return r}normalize(e){const t=this,n={};return mte.forEach(this,((r,a)=>{const o=mte.findKey(n,a);if(o)return t[o]=Pne(r),void delete t[a];const c=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(a):String(a).trim();c!==a&&delete t[a],t[c]=Pne(r),n[c]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return mte.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&mte.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[_ne]=this[_ne]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Dne(e);t[r]||(function(e,t){const n=mte.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,a){return this[r].call(this,t,e,n,a)},configurable:!0})}))}(n,e),t[r]=!0)}return mte.isArray(e)?e.forEach(r):r(e),this}}function Bne(e,t){const n=this||Rne,r=t||n,a=Ine.from(r.headers);let o=r.data;return mte.forEach(e,(function(e){o=e.call(n,o,a.normalize(),t?t.status:void 0)})),a.normalize(),o}function jne(e){return!(!e||!e.__CANCEL__)}function Une(e,t,n){dne.call(this,null==e?"canceled":e,dne.ERR_CANCELED,t,n),this.name="CanceledError"}function Wne(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new dne("Request failed with status code "+n.status,[dne.ERR_BAD_REQUEST,dne.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Ine.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),mte.reduceDescriptors(Ine.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),mte.freezeMethods(Ine),mte.inherits(Une,dne,{__CANCEL__:!0});const $ne=(e,t,n=3)=>{let r=0;const a=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a,o=0,c=0;return t=void 0!==t?t:1e3,function(i){const l=Date.now(),s=r[c];a||(a=l),n[o]=i,r[o]=l;let h=c,d=0;for(;h!==o;)d+=n[h++],h%=e;if(o=(o+1)%e,o===c&&(c=(c+1)%e),l-a<t)return;const u=s&&l-s;return u?Math.round(1e3*d/u):void 0}}(50,250);return function(e,t){let n,r,a=0,o=1e3/t;const c=(t,o=Date.now())=>{a=o,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),i=t-a;i>=o?c(e,t):(n=e,r||(r=setTimeout((()=>{r=null,c(n)}),o-i)))},()=>n&&c(n)]}((n=>{const o=n.loaded,c=n.lengthComputable?n.total:void 0,i=o-r,l=a(i);r=o,e({loaded:o,total:c,progress:c?o/c:void 0,bytes:i,rate:l||void 0,estimated:l&&c&&o<=c?(c-o)/l:void 0,event:n,lengthComputable:null!=c,[t?"download":"upload"]:!0})}),n)},qne=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Gne=e=>(...t)=>mte.asap((()=>e(...t)));var Yne=One.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,One.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(One.origin),One.navigator&&/(msie|trident)/i.test(One.navigator.userAgent)):()=>!0,Kne=One.hasStandardBrowserEnv?{write(e,t,n,r,a,o){const c=[e+"="+encodeURIComponent(t)];mte.isNumber(n)&&c.push("expires="+new Date(n).toGMTString()),mte.isString(r)&&c.push("path="+r),mte.isString(a)&&c.push("domain="+a),!0===o&&c.push("secure"),document.cookie=c.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Xne(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Qne=e=>e instanceof Ine?{...e}:e;function Jne(e,t){t=t||{};const n={};function r(e,t,n,r){return mte.isPlainObject(e)&&mte.isPlainObject(t)?mte.merge.call({caseless:r},e,t):mte.isPlainObject(t)?mte.merge({},t):mte.isArray(t)?t.slice():t}function a(e,t,n,a){return mte.isUndefined(t)?mte.isUndefined(e)?void 0:r(void 0,e,0,a):r(e,t,0,a)}function o(e,t){if(!mte.isUndefined(t))return r(void 0,t)}function c(e,t){return mte.isUndefined(t)?mte.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function i(n,a,o){return o in t?r(n,a):o in e?r(void 0,n):void 0}const l={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:i,headers:(e,t,n)=>a(Qne(e),Qne(t),0,!0)};return mte.forEach(Object.keys(Object.assign({},e,t)),(function(r){const o=l[r]||a,c=o(e[r],t[r],r);mte.isUndefined(c)&&o!==i||(n[r]=c)})),n}var Zne=e=>{const t=Jne({},e);let n,{data:r,withXSRFToken:a,xsrfHeaderName:o,xsrfCookieName:c,headers:i,auth:l}=t;if(t.headers=i=Ine.from(i),t.url=Hne(Xne(t.baseURL,t.url),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),mte.isFormData(r))if(One.hasStandardBrowserEnv||One.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(!1!==(n=i.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}if(One.hasStandardBrowserEnv&&(a&&mte.isFunction(a)&&(a=a(t)),a||!1!==a&&Yne(t.url))){const e=o&&c&&Kne.read(c);e&&i.set(o,e)}return t},ere="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=Zne(e);let a=r.data;const o=Ine.from(r.headers).normalize();let c,i,l,s,h,{responseType:d,onUploadProgress:u,onDownloadProgress:m}=r;function p(){s&&s(),h&&h(),r.cancelToken&&r.cancelToken.unsubscribe(c),r.signal&&r.signal.removeEventListener("abort",c)}let v=new XMLHttpRequest;function f(){if(!v)return;const r=Ine.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders());Wne((function(e){t(e),p()}),(function(e){n(e),p()}),{data:d&&"text"!==d&&"json"!==d?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:r,config:e,request:v}),v=null}v.open(r.method.toUpperCase(),r.url,!0),v.timeout=r.timeout,"onloadend"in v?v.onloadend=f:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(f)},v.onabort=function(){v&&(n(new dne("Request aborted",dne.ECONNABORTED,e,v)),v=null)},v.onerror=function(){n(new dne("Network Error",dne.ERR_NETWORK,e,v)),v=null},v.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const a=r.transitional||Cne;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new dne(t,a.clarifyTimeoutError?dne.ETIMEDOUT:dne.ECONNABORTED,e,v)),v=null},void 0===a&&o.setContentType(null),"setRequestHeader"in v&&mte.forEach(o.toJSON(),(function(e,t){v.setRequestHeader(t,e)})),mte.isUndefined(r.withCredentials)||(v.withCredentials=!!r.withCredentials),d&&"json"!==d&&(v.responseType=r.responseType),m&&([l,h]=$ne(m,!0),v.addEventListener("progress",l)),u&&v.upload&&([i,s]=$ne(u),v.upload.addEventListener("progress",i),v.upload.addEventListener("loadend",s)),(r.cancelToken||r.signal)&&(c=t=>{v&&(n(!t||t.type?new Une(null,e,v):t),v.abort(),v=null)},r.cancelToken&&r.cancelToken.subscribe(c),r.signal&&(r.signal.aborted?c():r.signal.addEventListener("abort",c)));const z=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);z&&-1===One.protocols.indexOf(z)?n(new dne("Unsupported protocol "+z+":",dne.ERR_BAD_REQUEST,e)):v.send(a||null)}))};const tre=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const a=function(e){if(!n){n=!0,c();const t=e instanceof Error?e:this.reason;r.abort(t instanceof dne?t:new Une(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,a(new dne(`timeout ${t} of ms exceeded`,dne.ETIMEDOUT))}),t);const c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)})),e=null)};e.forEach((e=>e.addEventListener("abort",a)));const{signal:i}=r;return i.unsubscribe=()=>mte.asap(c),i}},nre=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,a=0;for(;a<n;)r=a+t,yield e.slice(a,r),a=r},rre=(e,t,n,r)=>{const a=async function*(e,t){for await(const n of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}}(e))yield*nre(n,t)}(e,t);let o,c=0,i=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await a.next();if(t)return i(),void e.close();let o=r.byteLength;if(n){let e=c+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw i(e),e}},cancel:e=>(i(e),a.return())},{highWaterMark:2})},are="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ore=are&&"function"==typeof ReadableStream,cre=are&&("function"==typeof TextEncoder?(ire=new TextEncoder,e=>ire.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var ire;const lre=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},sre=ore&&lre((()=>{let e=!1;const t=new Request(One.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),hre=ore&&lre((()=>mte.isReadableStream(new Response("").body))),dre={stream:hre&&(e=>e.body)};var ure;are&&(ure=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!dre[e]&&(dre[e]=mte.isFunction(ure[e])?t=>t[e]():(t,n)=>{throw new dne(`Response type '${e}' is not supported`,dne.ERR_NOT_SUPPORT,n)})})));var mre=are&&(async e=>{let{url:t,method:n,data:r,signal:a,cancelToken:o,timeout:c,onDownloadProgress:i,onUploadProgress:l,responseType:s,headers:h,withCredentials:d="same-origin",fetchOptions:u}=Zne(e);s=s?(s+"").toLowerCase():"text";let m,p=tre([a,o&&o.toAbortSignal()],c);const v=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let f;try{if(l&&sre&&"get"!==n&&"head"!==n&&0!==(f=await(async(e,t)=>{const n=mte.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(mte.isBlob(e))return e.size;if(mte.isSpecCompliantForm(e)){const t=new Request(One.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return mte.isArrayBufferView(e)||mte.isArrayBuffer(e)?e.byteLength:(mte.isURLSearchParams(e)&&(e+=""),mte.isString(e)?(await cre(e)).byteLength:void 0)})(t):n})(h,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(mte.isFormData(r)&&(e=n.headers.get("content-type"))&&h.setContentType(e),n.body){const[e,t]=qne(f,$ne(Gne(l)));r=rre(n.body,65536,e,t)}}mte.isString(d)||(d=d?"include":"omit");const a="credentials"in Request.prototype;m=new Request(t,{...u,signal:p,method:n.toUpperCase(),headers:h.normalize().toJSON(),body:r,duplex:"half",credentials:a?d:void 0});let o=await fetch(m);const c=hre&&("stream"===s||"response"===s);if(hre&&(i||c&&v)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=mte.toFiniteNumber(o.headers.get("content-length")),[n,r]=i&&qne(t,$ne(Gne(i),!0))||[];o=new Response(rre(o.body,65536,n,(()=>{r&&r(),v&&v()})),e)}s=s||"text";let z=await dre[mte.findKey(dre,s)||"text"](o,e);return!c&&v&&v(),await new Promise(((t,n)=>{Wne(t,n,{data:z,headers:Ine.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:m})}))}catch(t){if(v&&v(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new dne("Network Error",dne.ERR_NETWORK,e,m),{cause:t.cause||t});throw dne.from(t,t&&t.code,e,m)}});const pre={http:null,xhr:ere,fetch:mre};mte.forEach(pre,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const vre=e=>`- ${e}`,fre=e=>mte.isFunction(e)||null===e||!1===e;var zre=e=>{e=mte.isArray(e)?e:[e];const{length:t}=e;let n,r;const a={};for(let o=0;o<t;o++){let t;if(n=e[o],r=n,!fre(n)&&(r=pre[(t=String(n)).toLowerCase()],void 0===r))throw new dne(`Unknown adapter '${t}'`);if(r)break;a[t||"#"+o]=r}if(!r){const e=Object.entries(a).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new dne("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(vre).join("\n"):" "+vre(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function gre(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Une(null,e)}function yre(e){return gre(e),e.headers=Ine.from(e.headers),e.data=Bne.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),zre(e.adapter||Rne.adapter)(e).then((function(t){return gre(e),t.data=Bne.call(e,e.transformResponse,t),t.headers=Ine.from(t.headers),t}),(function(t){return jne(t)||(gre(e),t&&t.response&&(t.response.data=Bne.call(e,e.transformResponse,t.response),t.response.headers=Ine.from(t.response.headers))),Promise.reject(t)}))}const Mre={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Mre[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const Ere={};Mre.transitional=function(e,t,n){function r(e,t){return"[Axios v1.7.9] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,a,o)=>{if(!1===e)throw new dne(r(a," has been removed"+(t?" in "+t:"")),dne.ERR_DEPRECATED);return t&&!Ere[a]&&(Ere[a]=!0,console.warn(r(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,a,o)}},Mre.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var bre={assertOptions:function(e,t,n){if("object"!=typeof e)throw new dne("options must be an object",dne.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const o=r[a],c=t[o];if(c){const t=e[o],n=void 0===t||c(t,o,e);if(!0!==n)throw new dne("option "+o+" must be "+n,dne.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new dne("Unknown option "+o,dne.ERR_BAD_OPTION)}},validators:Mre};const Hre=bre.validators;class Vre{constructor(e){this.defaults=e,this.interceptors={request:new Vne,response:new Vne}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Jne(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:a}=t;void 0!==n&&bre.assertOptions(n,{silentJSONParsing:Hre.transitional(Hre.boolean),forcedJSONParsing:Hre.transitional(Hre.boolean),clarifyTimeoutError:Hre.transitional(Hre.boolean)},!1),null!=r&&(mte.isFunction(r)?t.paramsSerializer={serialize:r}:bre.assertOptions(r,{encode:Hre.function,serialize:Hre.function},!0)),bre.assertOptions(t,{baseUrl:Hre.spelling("baseURL"),withXsrfToken:Hre.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&mte.merge(a.common,a[t.method]);a&&mte.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete a[e]})),t.headers=Ine.concat(o,a);const c=[];let i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,c.unshift(e.fulfilled,e.rejected))}));const l=[];let s;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let h,d=0;if(!i){const e=[yre.bind(this),void 0];for(e.unshift.apply(e,c),e.push.apply(e,l),h=e.length,s=Promise.resolve(t);d<h;)s=s.then(e[d++],e[d++]);return s}h=c.length;let u=t;for(d=0;d<h;){const t=c[d++],n=c[d++];try{u=t(u)}catch(e){n.call(this,e);break}}try{s=yre.call(this,u)}catch(e){return Promise.reject(e)}for(d=0,h=l.length;d<h;)s=s.then(l[d++],l[d++]);return s}getUri(e){return Hne(Xne((e=Jne(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}mte.forEach(["delete","get","head","options"],(function(e){Vre.prototype[e]=function(t,n){return this.request(Jne(n||{},{method:e,url:t,data:(n||{}).data}))}})),mte.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,a){return this.request(Jne(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Vre.prototype[e]=t(),Vre.prototype[e+"Form"]=t(!0)}));class Cre{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,a){n.reason||(n.reason=new Une(e,r,a),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Cre((function(t){e=t})),cancel:e}}}const Lre={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Lre).forEach((([e,t])=>{Lre[t]=e}));const kre=function e(t){const n=new Vre(t),r=Hee(Vre.prototype.request,n);return mte.extend(r,Vre.prototype,n,{allOwnKeys:!0}),mte.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Jne(t,n))},r}(Rne);kre.Axios=Vre,kre.CanceledError=Une,kre.CancelToken=Cre,kre.isCancel=jne,kre.VERSION="1.7.9",kre.toFormData=gne,kre.AxiosError=dne,kre.Cancel=kre.CanceledError,kre.all=function(e){return Promise.all(e)},kre.spread=function(e){return function(t){return e.apply(null,t)}},kre.isAxiosError=function(e){return mte.isObject(e)&&!0===e.isAxiosError},kre.mergeConfig=Jne,kre.AxiosHeaders=Ine,kre.formToJSON=e=>Ane(mte.isHTMLForm(e)?new FormData(e):e),kre.getAdapter=zre,kre.HttpStatusCode=Lre,kre.default=kre;var wre=function(){function e(){}return e.convertJsonToQueryParamsString=function(e){return Object.keys(e).map((function(t){return t+"="+e[t]})).join("&")},e}(),Sre=function(){function e(e){var t=this;this._backendBaseUrl="",this.updatePdf=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.put("".concat(this.getPdfApisEndPointRoute()),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchOnlyPdfData=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfApisEndPointRoute(),"/get"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchOnlyPdfPagesData=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfPagesApisEndPointRoute(),"?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.createCommentThread=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfApisEndPointRoute(),"/commentThreads"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.deleteCommentThread=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfApisEndPointRoute(),"/commentThreads/delete"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.getCommentThreadById=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfApisEndPointRoute(),"/commentThreads/").concat(e.commentThreadId))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchCommentThreads=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfApisEndPointRoute(),"/commentThreads?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.createComment=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfApisEndPointRoute(),"/commentThreads/comments"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchUsersOfPdf=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfApisEndPointRoute(),"/getUsers?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.createPageAnnotation=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:if(Object.keys(e.annotation||{}).length>1)throw new Error("invalid request payload");return[4,null===(n=this.api)||void 0===n?void 0:n.post(this.getPdfPagesAnnotationApisEndPointRoute(),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchAnnotation=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfPagesAnnotationApisEndPointRoute(),"?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchAllAnnotationsOfThePage=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfPagesAnnotationApisEndPointRoute(),"?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.updatePageAnnotation=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.put(this.getPdfPagesAnnotationApisEndPointRoute(),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.deletePageAnnotation=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.delete("".concat(this.getPdfPagesAnnotationApisEndPointRoute(),"?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchPdfScales=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfScalesApisEndPointRoute(),"/get"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.createPdfScale=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfScalesApisEndPointRoute()),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.deletePdfScale=function(e){return K7(t,void 0,void 0,(function(){var t;return X7(this,(function(n){switch(n.label){case 0:return[4,null===(t=this.api)||void 0===t?void 0:t.post("".concat(this.getPdfScalesApisEndPointRoute(),"/delete"),e)];case 1:return n.sent(),[2]}}))}))},this.updatePdfScale=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.put("".concat(this.getPdfScalesApisEndPointRoute(),"/update"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.convertImageToPdf=function(e){var n=e.imageDownloadUrl,r=e.imageWidth,a=e.imageHeight;return K7(t,void 0,void 0,(function(){var e,t,o,c,i;return X7(this,(function(l){switch(l.label){case 0:return e={pdfFileName:"image.pdf",imageDetails:{imageDownloadUrl:n,imageWidth:r,imageHeight:a}},[4,null===(o=this.api)||void 0===o?void 0:o.post("".concat(this.getPdfApisEndPointRoute()),e)];case 1:if(t=l.sent(),!(null===(c=null==t?void 0:t.data)||void 0===c?void 0:c._id))throw new Error("pdfId not found");return[4,null===(i=this.api)||void 0===i?void 0:i.post("".concat(this.getPdfApisEndPointRoute(),"/pdf-pages-as-images"),{pdfId:null==t?void 0:t.data._id})];case 2:return l.sent(),[2,{_id:null==t?void 0:t.data._id}]}}))}))},this.backendBaseUrl=e.backendBaseUrl,this.api=kre.create({baseURL:this.backendBaseUrl,headers:{"Content-type":"application/json; charset=utf-8"},withCredentials:!0})}return Object.defineProperty(e.prototype,"backendBaseUrl",{get:function(){return this._backendBaseUrl},set:function(e){this._backendBaseUrl=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"api",{get:function(){return this._api},set:function(e){this._api=e},enumerable:!1,configurable:!0}),e.prototype.getPdfApisEndPointRoute=function(){return"".concat(this.backendBaseUrl,"/pdfs")},e.prototype.getPdfPagesApisEndPointRoute=function(){return"".concat(this.getPdfApisEndPointRoute(),"/pages")},e.prototype.getPdfScalesApisEndPointRoute=function(){return"".concat(this.getPdfApisEndPointRoute(),"/scales")},e.prototype.getPdfPagesAnnotationApisEndPointRoute=function(){return"".concat(this.getPdfPagesApisEndPointRoute(),"/annotation")},e.calculateDistanceBetweenTwoCoordinatesInPdfPagePoints=function(e){var t=e.normalisedCoordinates2.x-e.normalisedCoordinates1.x,n=e.normalisedCoordinates2.y-e.normalisedCoordinates1.y;return Math.sqrt(t*t+n*n)/(e.pdfPageImageOriginalWidth/e.pdfPageOriginalWidthInPoints)},e.convertPdfPagePointsDistanceToInches=function(e){return e.pdfPagePointsDistance/72},e.convertInchesToCentimeters=function(e){return 2.54*e.inches},e.convertInchesToMeters=function(e){return e.inches/39.37},e.convertInchesToFeet=function(e){return e.inches/12},e.convertInchesDistanceToPdfPagePoints=function(e){return 72*e.inchesDistance},e.isUserMoreNearToHorizontalAxisOrVerticalAxis=function(e){var t=e.firstCoordinate,n=e.secondCoordinate,r=n.x-t.x,a=n.y-t.y;return Math.abs(r)>Math.abs(a)?"horizontal":"vertical"},e.prototype.insertPdfAndItsPagesInDb=function(e){var t,n,r;return K7(this,void 0,void 0,(function(){var a,o,c;return X7(this,(function(i){switch(i.label){case 0:return(a=new FormData).append("pdfDownloadUrl",e.pdfSourceUrl),e.pdfFileName&&a.append("pdfFileName",e.pdfFileName),[4,null===(t=this.api)||void 0===t?void 0:t.post("".concat(this.getPdfApisEndPointRoute()),a,{headers:{"Content-Type":"multipart/form-data"}})];case 1:if(o=i.sent(),!(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n._id))throw new Error("pdfId not found");return c=null===(r=this.api)||void 0===r?void 0:r.post("".concat(this.getPdfApisEndPointRoute(),"/pdf-pages-as-images"),{pdfId:null==o?void 0:o.data._id}),e.shouldWaitForPdfPagesCreation?[4,c]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2,{_id:null==o?void 0:o.data._id}]}}))}))},e.convertNormalisedCoordinatesToUnNormalisedCoordinates=function(t){for(var n=t.normalisedCoordinates,r=t.normalisedXDimension,a=t.normalisedYDimension,o=t.unNormalisedXDimension,c=t.unNormalisedYDimension,i=[],l=0,s=n;l<s.length;l++){var h=s[l],d=h.x,u=h.y,m=e.convertNormalisedValueToUnNormalisedForShowingInUI({normalisedValue:d,normalisedDimension:r,unNormalisedDimension:o}),p=e.convertNormalisedValueToUnNormalisedForShowingInUI({normalisedValue:u,normalisedDimension:a,unNormalisedDimension:c});i.push({x:m,y:p})}return i},e.doNotMakeCoordinatesGoOutOfBoundary=function(e){for(var t=e.coordinates,n=e.coordinateBoundaries,r=0,a=t;r<a.length;r++){var o=a[r];o.x<n.xMin?o.x=n.xMin:o.x>n.xMax&&(o.x=n.xMax),o.y<n.yMin?o.y=n.yMin:o.y>n.yMax&&(o.y=n.yMax)}return t},e.prototype.insertPdfAndItsPagesInDBViaHTML=function(e){var t,n,r;return K7(this,void 0,void 0,(function(){var a,o,c,i,l,s,h;return X7(this,(function(d){switch(d.label){case 0:if(!(a=document.getElementById(e.htmlElementId)))throw new Error("htmlELement corresponding to the id not found");return o=a.outerHTML,e.cssClassNamesWhichShouldBeRemovedBeforeHtmlToPdfConversion.forEach((function(e){o=o.replaceAll(e,"")})),c=Array.from(document.querySelectorAll("style")).map((function(e){return e.outerHTML})).join("\n"),i='\n <html>\n <head>\n <meta charset="UTF-8">\n '.concat(c,"\n </head>\n <body>\n ").concat(o,"\n </body>\n </html>\n "),l={pdfFileName:"react-html.pdf",htmlDocument:{document:i,width:a.clientWidth}},[4,null===(t=this.api)||void 0===t?void 0:t.post("".concat(this.getPdfApisEndPointRoute()),l)];case 1:if(s=d.sent(),!(null===(n=null==s?void 0:s.data)||void 0===n?void 0:n._id))throw new Error("pdfId not found");return h=null===(r=this.api)||void 0===r?void 0:r.post("".concat(this.getPdfApisEndPointRoute(),"/pdf-pages-as-images"),{pdfId:null==s?void 0:s.data._id}),e.shouldWaitForPdfPagesCreation?[4,h]:[3,3];case 2:d.sent(),d.label=3;case 3:return[2,{_id:null==s?void 0:s.data._id}]}}))}))},e.convertValueFromOneUnitToAnotherUnit=function(e){var t=e.valueToConvert,n=e.fromUnit,r=e.toUnit;if(n===r)return t;var a=0;if("cm"===n)if("m"===r)a=t/100;else if("inch"===r)a=t/2.54;else{if("ft"!==r)throw new Error("Invalid toUnit");a=t/30.48}else if("m"===n)if("cm"===r)a=100*t;else if("inch"===r)a=39.37*t;else{if("ft"!==r)throw new Error("Invalid toUnit");a=3.281*t}else if("inch"===n)if("cm"===r)a=2.54*t;else if("m"===r)a=t/39.37;else{if("ft"!==r)throw new Error("Invalid toUnit");a=t/12}else{if("ft"!==n)throw new Error("Invalid fromUnit");if("cm"===r)a=30.48*t;else if("m"===r)a=t/3.281;else{if("inch"!==r)throw new Error("Invalid toUnit");a=12*t}}return a},e.convertNormalisedValueToUnNormalisedForShowingInUI=function(e){var t=e.normalisedValue,n=e.normalisedDimension;return t*(e.unNormalisedDimension/n)},e.convertUnNormalisedValueToNormalised=function(e){var t=e.unNormalisedValue,n=e.normalisedDimension;return t/(e.unNormalisedDimension/n)},e.convertCoordinatesArrayToNumberArray=function(e){for(var t=e.coordinates,n=[],r=0;r<t.length;r++)n.push(t[r].x),n.push(t[r].y);return n},e}(),xre=function(){function e(){}return e.getImageWidthHeightFromURL=function(e){return K7(this,void 0,void 0,(function(){var t;return X7(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,new Promise((function(t,n){try{var r=new Image;r.onload=function(){return t({width:r.width,height:r.height})},r.src=e}catch(e){n(new Error(e.message))}}))];case 1:return[2,n.sent()];case 2:throw t=n.sent(),new Error(t.message);case 3:return[2]}}))}))},e.getImageHeight=function(e,t){return e/t},e.getImageWidth=function(e,t){return e*t},e.downloadImage=function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=function(){return n(new Error("Image loading having url ".concat(e," got failed")))},r.src=e}))},e}(),Tre={d:(e,t)=>{for(var n in t)Tre.o(t,n)&&!Tre.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},Ore=globalThis.pdfjsLib={};Tre.d(Ore,{AbortException:()=>cae,AnnotationEditorLayer:()=>Pie,AnnotationEditorParamsType:()=>Fre,AnnotationEditorType:()=>Pre,AnnotationEditorUIManager:()=>$ae,AnnotationLayer:()=>yie,AnnotationMode:()=>Dre,ColorPicker:()=>Sie,DOMSVGFactory:()=>Bce,DrawLayer:()=>Fie,FeatureTest:()=>hae,GlobalWorkerOptions:()=>Boe,ImageKind:()=>Bre,InvalidPDFException:()=>nae,MissingPDFException:()=>rae,OPS:()=>Ure,OutputScale:()=>_ae,PDFDataRangeTransport:()=>Cce,PDFDateString:()=>xae,PDFWorker:()=>Sce,PasswordResponses:()=>Wre,PermissionFlag:()=>Ire,PixelsPerInch:()=>gae,RenderingCancelledException:()=>Eae,TextLayer:()=>vce,TouchManager:()=>Gae,UnexpectedResponseException:()=>aae,Util:()=>uae,VerbosityLevel:()=>jre,XfaLayer:()=>jce,build:()=>_ce,createValidAbsoluteUrl:()=>Qre,fetchData:()=>yae,getDocument:()=>bce,getFilenameFromUrl:()=>Vae,getPdfFilenameFromUrl:()=>Cae,getXfaPageViewport:()=>Tae,isDataScheme:()=>bae,isPdfFile:()=>Hae,noContextMenu:()=>wae,normalizeUnicode:()=>vae,setLayerDimensions:()=>Nae,shadow:()=>Jre,stopEvent:()=>Sae,version:()=>Nce});const Are=!("object"!=typeof St||St+""!="[object process]"||St.versions.nw||St.versions.electron&&St.type&&"browser"!==St.type),Rre=[1,0,0,1,0,0],Nre=[.001,0,0,.001,0,0],_re=1.35,Dre={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Pre={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Fre={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},Ire={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Bre={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},jre={ERRORS:0,WARNINGS:1,INFOS:5},Ure={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},Wre={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let $re=jre.WARNINGS;function qre(){return $re}function Gre(e){$re>=jre.INFOS&&console.log(`Info: ${e}`)}function Yre(e){$re>=jre.WARNINGS&&console.log(`Warning: ${e}`)}function Kre(e){throw new Error(e)}function Xre(e,t){e||Kre(t)}function Qre(e,t=null,n=null){if(!e)return null;try{if(n&&"string"==typeof e){if(n.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(n.tryConvertEncoding)try{e=decodeURIComponent(escape(e))}catch{}}const r=t?new URL(e,t):new URL(e);if(function(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch{}return null}function Jre(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}const Zre=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=new Error,e.constructor=e,e}();class eae extends Zre{constructor(e,t){super(e,"PasswordException"),this.code=t}}class tae extends Zre{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class nae extends Zre{constructor(e){super(e,"InvalidPDFException")}}class rae extends Zre{constructor(e){super(e,"MissingPDFException")}}class aae extends Zre{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class oae extends Zre{constructor(e){super(e,"FormatError")}}class cae extends Zre{constructor(e){super(e,"AbortException")}}function iae(e){"object"==typeof e&&void 0!==e?.length||Kre("Invalid argument for bytesToString");const t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);const r=[];for(let a=0;a<t;a+=n){const o=Math.min(a+n,t),c=e.subarray(a,o);r.push(String.fromCharCode.apply(null,c))}return r.join("")}function lae(e){"string"!=typeof e&&Kre("Invalid argument for stringToBytes");const t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=255&e.charCodeAt(r);return n}function sae(e){const t=Object.create(null);for(const[n,r]of e)t[n]=r;return t}class hae{static get isLittleEndian(){return Jre(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return Jre(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return Jre(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return Jre(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?Jre(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):Jre(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return Jre(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const dae=Array.from(Array(256).keys(),(e=>e.toString(16).padStart(2,"0")));class uae{static makeHexColor(e,t,n){return`#${dae[e]}${dae[t]}${dae[n]}`}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[1],t[1]=n,n=t[2],t[2]=t[3],t[3]=n,e[1]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){const n=this.applyTransform(e,t),r=this.applyTransform(e.slice(2,4),t),a=this.applyTransform([e[0],e[3]],t),o=this.applyTransform([e[2],e[1]],t);return[Math.min(n[0],r[0],a[0],o[0]),Math.min(n[1],r[1],a[1],o[1]),Math.max(n[0],r[0],a[0],o[0]),Math.max(n[1],r[1],a[1],o[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],a=e[2]*t[0]+e[3]*t[2],o=e[2]*t[1]+e[3]*t[3],c=(n+o)/2,i=Math.sqrt((n+o)**2-4*(n*o-a*r))/2,l=c+i||1,s=c-i||1;return[Math.sqrt(l),Math.sqrt(s)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;const a=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return a>o?null:[n,a,r,o]}static#e(e,t,n,r,a,o,c,i,l,s){if(l<=0||l>=1)return;const h=1-l,d=l*l,u=d*l,m=h*(h*(h*e+3*l*t)+3*d*n)+u*r,p=h*(h*(h*a+3*l*o)+3*d*c)+u*i;s[0]=Math.min(s[0],m),s[1]=Math.min(s[1],p),s[2]=Math.max(s[2],m),s[3]=Math.max(s[3],p)}static#t(e,t,n,r,a,o,c,i,l,s,h,d){if(Math.abs(l)<1e-12)return void(Math.abs(s)>=1e-12&&this.#e(e,t,n,r,a,o,c,i,-h/s,d));const u=s**2-4*h*l;if(u<0)return;const m=Math.sqrt(u),p=2*l;this.#e(e,t,n,r,a,o,c,i,(-s+m)/p,d),this.#e(e,t,n,r,a,o,c,i,(-s-m)/p,d)}static bezierBoundingBox(e,t,n,r,a,o,c,i,l){return l?(l[0]=Math.min(l[0],e,c),l[1]=Math.min(l[1],t,i),l[2]=Math.max(l[2],e,c),l[3]=Math.max(l[3],t,i)):l=[Math.min(e,c),Math.min(t,i),Math.max(e,c),Math.max(t,i)],this.#t(e,n,a,c,t,r,o,i,3*(3*(n-a)-e+c),6*(e-2*n+a),3*(n-e),l),this.#t(e,n,a,c,t,r,o,i,3*(3*(r-o)-t+i),6*(t-2*r+o),3*(r-t),l),l}}let mae=null,pae=null;function vae(e){return mae||(mae=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,pae=new Map([["ſt","ſt"]])),e.replaceAll(mae,((e,t,n)=>t?t.normalize("NFKC"):pae.get(n)))}const fae="pdfjs_internal_id_";"function"!=typeof Promise.try&&(Promise.try=function(e,...t){return new Promise((n=>{n(e(...t))}))});const zae="http://www.w3.org/2000/svg";class gae{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function yae(e,t="text"){if(kae(e,document.baseURI)){const n=await fetch(e);if(!n.ok)throw new Error(n.statusText);switch(t){case"arraybuffer":return n.arrayBuffer();case"blob":return n.blob();case"json":return n.json()}return n.text()}return new Promise(((n,r)=>{const a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType=t,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE)if(200!==a.status&&0!==a.status)r(new Error(a.statusText));else{switch(t){case"arraybuffer":case"blob":case"json":return void n(a.response)}n(a.responseText)}},a.send(null)}))}class Mae{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:a=0,offsetY:o=0,dontFlip:c=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=a,this.offsetY=o,n*=t;const i=(e[2]+e[0])/2,l=(e[3]+e[1])/2;let s,h,d,u,m,p,v,f;switch((r%=360)<0&&(r+=360),r){case 180:s=-1,h=0,d=0,u=1;break;case 90:s=0,h=1,d=1,u=0;break;case 270:s=0,h=-1,d=-1,u=0;break;case 0:s=1,h=0,d=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}c&&(d=-d,u=-u),0===s?(m=Math.abs(l-e[1])*n+a,p=Math.abs(i-e[0])*n+o,v=(e[3]-e[1])*n,f=(e[2]-e[0])*n):(m=Math.abs(i-e[0])*n+a,p=Math.abs(l-e[1])*n+o,v=(e[2]-e[0])*n,f=(e[3]-e[1])*n),this.transform=[s*n,h*n,d*n,u*n,m-s*n*i-d*n*l,p-h*n*i-u*n*l],this.width=v,this.height=f}get rawDims(){const{userUnit:e,viewBox:t}=this,n=t.map((t=>t*e));return Jre(this,"rawDims",{pageWidth:n[2]-n[0],pageHeight:n[3]-n[1],pageX:n[0],pageY:n[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:r=this.offsetY,dontFlip:a=!1}={}){return new Mae({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:a})}convertToViewportPoint(e,t){return uae.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=uae.applyTransform([e[0],e[1]],this.transform),n=uae.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){return uae.applyInverseTransform([e,t],this.transform)}}class Eae extends Zre{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function bae(e){const t=e.length;let n=0;for(;n<t&&""===e[n].trim();)n++;return"data:"===e.substring(n,n+5).toLowerCase()}function Hae(e){return"string"==typeof e&&/\.pdf$/i.test(e)}function Vae(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function Cae(e,t="document.pdf"){if("string"!=typeof e)return t;if(bae(e))return Yre('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,r=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let a=n.exec(r[1])||n.exec(r[2])||n.exec(r[3]);if(a&&(a=a[0],a.includes("%")))try{a=n.exec(decodeURIComponent(a))[0]}catch{}return a||t}class Lae{started=Object.create(null);times=[];time(e){e in this.started&&Yre(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Yre(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:e}of this.times)t=Math.max(e.length,t);for(const{name:n,start:r,end:a}of this.times)e.push(`${n.padEnd(t)} ${a-r}ms\n`);return e.join("")}}function kae(e,t){try{const{protocol:n}=t?new URL(e,t):new URL(e);return"http:"===n||"https:"===n}catch{return!1}}function wae(e){e.preventDefault()}function Sae(e){e.preventDefault(),e.stopPropagation()}class xae{static#n;static toDateObject(e){if(!e||"string"!=typeof e)return null;this.#n||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const t=this.#n.exec(e);if(!t)return null;const n=parseInt(t[1],10);let r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let a=parseInt(t[3],10);a=a>=1&&a<=31?a:1;let o=parseInt(t[4],10);o=o>=0&&o<=23?o:0;let c=parseInt(t[5],10);c=c>=0&&c<=59?c:0;let i=parseInt(t[6],10);i=i>=0&&i<=59?i:0;const l=t[7]||"Z";let s=parseInt(t[8],10);s=s>=0&&s<=23?s:0;let h=parseInt(t[9],10)||0;return h=h>=0&&h<=59?h:0,"-"===l?(o+=s,c+=h):"+"===l&&(o-=s,c-=h),new Date(Date.UTC(n,r,a,o,c,i))}}function Tae(e,{scale:t=1,rotation:n=0}){const{width:r,height:a}=e.attributes.style,o=[0,0,parseInt(r),parseInt(a)];return new Mae({viewBox:o,userUnit:1,scale:t,rotation:n})}function Oae(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):(Yre(`Not a valid color format: "${e}"`),[0,0,0])}function Aae(e){const{a:t,b:n,c:r,d:a,e:o,f:c}=e.getTransform();return[t,n,r,a,o,c]}function Rae(e){const{a:t,b:n,c:r,d:a,e:o,f:c}=e.getTransform().invertSelf();return[t,n,r,a,o,c]}function Nae(e,t,n=!1,r=!0){if(t instanceof Mae){const{pageWidth:r,pageHeight:a}=t.rawDims,{style:o}=e,c=hae.isCSSRoundSupported,i=`var(--scale-factor) * ${r}px`,l=`var(--scale-factor) * ${a}px`,s=c?`round(down, ${i}, var(--scale-round-x, 1px))`:`calc(${i})`,h=c?`round(down, ${l}, var(--scale-round-y, 1px))`:`calc(${l})`;n&&t.rotation%180!=0?(o.width=h,o.height=s):(o.width=s,o.height=h)}r&&e.setAttribute("data-main-rotation",t.rotation)}class _ae{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}class Dae{#r=null;#a=null;#o;#c=null;#i=null;static#l=null;constructor(e){this.#o=e,Dae.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"})}render(){const e=this.#r=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=this.#o._uiManager._signal;e.addEventListener("contextmenu",wae,{signal:t}),e.addEventListener("pointerdown",Dae.#s,{signal:t});const n=this.#c=document.createElement("div");n.className="buttons",e.append(n);const r=this.#o.toolbarPosition;if(r){const{style:t}=e,n="ltr"===this.#o._uiManager.direction?1-r[0]:r[0];t.insetInlineEnd=100*n+"%",t.top=`calc(${100*r[1]}% + var(--editor-toolbar-vert-offset))`}return this.#h(),e}get div(){return this.#r}static#s(e){e.stopPropagation()}#d(e){this.#o._focusEventsAllowed=!1,Sae(e)}#u(e){this.#o._focusEventsAllowed=!0,Sae(e)}#m(e){const t=this.#o._uiManager._signal;e.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",this.#u.bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",wae,{signal:t})}hide(){this.#r.classList.add("hidden"),this.#a?.hideDropdown()}show(){this.#r.classList.remove("hidden"),this.#i?.shown()}#h(){const{editorType:e,_uiManager:t}=this.#o,n=document.createElement("button");n.className="delete",n.tabIndex=0,n.setAttribute("data-l10n-id",Dae.#l[e]),this.#m(n),n.addEventListener("click",(e=>{t.delete()}),{signal:t._signal}),this.#c.append(n)}get#p(){const e=document.createElement("div");return e.className="divider",e}async addAltText(e){const t=await e.render();this.#m(t),this.#c.prepend(t,this.#p),this.#i=e}addColorPicker(e){this.#a=e;const t=e.renderButton();this.#m(t),this.#c.prepend(t,this.#p)}remove(){this.#r.remove(),this.#a?.destroy(),this.#a=null}}class Pae{#c=null;#r=null;#v;constructor(e){this.#v=e}#f(){const e=this.#r=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",wae,{signal:this.#v._signal});const t=this.#c=document.createElement("div");return t.className="buttons",e.append(t),this.#z(),e}#g(e,t){let n=0,r=0;for(const a of e){const e=a.y+a.height;if(e<n)continue;const o=a.x+(t?a.width:0);e>n?(r=o,n=e):t?o>r&&(r=o):o<r&&(r=o)}return[t?1-r:r,n]}show(e,t,n){const[r,a]=this.#g(t,n),{style:o}=this.#r||=this.#f();e.append(this.#r),o.insetInlineEnd=100*r+"%",o.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){this.#r.remove()}#z(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=this.#v._signal;e.addEventListener("contextmenu",wae,{signal:n}),e.addEventListener("click",(()=>{this.#v.highlightSelection("floating_button")}),{signal:n}),this.#c.append(e)}}function Fae(e,t,n){for(const r of n)t.addEventListener(r,e[r].bind(e))}class Iae{#y=0;get id(){return"pdfjs_internal_editor_"+this.#y++}}class Bae{#M=function(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();const e=new Uint8Array(32);return crypto.getRandomValues(e),iae(e)}();#y=0;#E=null;static get _isSVGFittingCanvas(){const e=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),t=new Image;return t.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',Jre(this,"_isSVGFittingCanvas",t.decode().then((()=>(e.drawImage(t,0,0,1,1,0,0,1,3),0===new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]))))}async#b(e,t){this.#E||=new Map;let n=this.#E.get(e);if(null===n)return null;if(n?.bitmap)return n.refCounter+=1,n;try{let e;if(n||={bitmap:null,id:`image_${this.#M}_${this.#y++}`,refCounter:0,isSvg:!1},"string"==typeof t?(n.url=t,e=await yae(t,"blob")):t instanceof File?e=n.file=t:t instanceof Blob&&(e=t),"image/svg+xml"===e.type){const t=Bae._isSVGFittingCanvas,r=new FileReader,a=new Image,o=new Promise(((e,o)=>{a.onload=()=>{n.bitmap=a,n.isSvg=!0,e()},r.onload=async()=>{const e=n.svgUrl=r.result;a.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},a.onerror=r.onerror=o}));r.readAsDataURL(e),await o}else n.bitmap=await createImageBitmap(e);n.refCounter=1}catch(e){Yre(e),n=null}return this.#E.set(e,n),n&&this.#E.set(n.id,n),n}async getFromFile(e){const{lastModified:t,name:n,size:r,type:a}=e;return this.#b(`${t}_${n}_${r}_${a}`,e)}async getFromUrl(e){return this.#b(e,e)}async getFromBlob(e,t){const n=await t;return this.#b(e,n)}async getFromId(e){this.#E||=new Map;const t=this.#E.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#E||=new Map;let n=this.#E.get(e);if(n?.bitmap)return n.refCounter+=1,n;const r=new OffscreenCanvas(t.width,t.height);return r.getContext("2d").drawImage(t,0,0),n={bitmap:r.transferToImageBitmap(),id:`image_${this.#M}_${this.#y++}`,refCounter:1,isSvg:!1},this.#E.set(e,n),this.#E.set(n.id,n),n}getSvgUrl(e){const t=this.#E.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#E||=new Map;const t=this.#E.get(e);if(!t)return;if(t.refCounter-=1,0!==t.refCounter)return;const{bitmap:n}=t;if(!t.url&&!t.file){const e=new OffscreenCanvas(n.width,n.height);e.getContext("bitmaprenderer").transferFromImageBitmap(n),t.blobPromise=e.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#M}_`)}}class jae{#H=[];#V=!1;#C;#L=-1;constructor(e=128){this.#C=e}add({cmd:e,undo:t,post:n,mustExec:r,type:a=NaN,overwriteIfSameType:o=!1,keepUndo:c=!1}){if(r&&e(),this.#V)return;const i={cmd:e,undo:t,post:n,type:a};if(-1===this.#L)return this.#H.length>0&&(this.#H.length=0),this.#L=0,void this.#H.push(i);if(o&&this.#H[this.#L].type===a)return c&&(i.undo=this.#H[this.#L].undo),void(this.#H[this.#L]=i);const l=this.#L+1;l===this.#C?this.#H.splice(0,1):(this.#L=l,l<this.#H.length&&this.#H.splice(l)),this.#H.push(i)}undo(){if(-1===this.#L)return;this.#V=!0;const{undo:e,post:t}=this.#H[this.#L];e(),t?.(),this.#V=!1,this.#L-=1}redo(){if(this.#L<this.#H.length-1){this.#L+=1,this.#V=!0;const{cmd:e,post:t}=this.#H[this.#L];e(),t?.(),this.#V=!1}}hasSomethingToUndo(){return-1!==this.#L}hasSomethingToRedo(){return this.#L<this.#H.length-1}cleanType(e){if(-1!==this.#L){for(let t=this.#L;t>=0;t--)if(this.#H[t].type!==e)return this.#H.splice(t+1,this.#L-t),void(this.#L=t);this.#H.length=0,this.#L=-1}}destroy(){this.#H=null}}class Uae{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=hae.platform;for(const[n,r,a={}]of e)for(const e of n){const n=e.startsWith("mac+");t&&n?(this.callbacks.set(e.slice(4),{callback:r,options:a}),this.allKeys.add(e.split("+").at(-1))):t||n||(this.callbacks.set(e,{callback:r,options:a}),this.allKeys.add(e.split("+").at(-1)))}}#k(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const n=this.callbacks.get(this.#k(t));if(!n)return;const{callback:r,options:{bubbles:a=!1,args:o=[],checker:c=null}}=n;c&&!c(e,t)||(r.bind(e,...o,t)(),a||Sae(t))}}class Wae{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return function(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const n of e.keys()){t.style.color=n;const r=window.getComputedStyle(t).color;e.set(n,Oae(r))}t.remove()}(e),Jre(this,"_colors",e)}convert(e){const t=Oae(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,n]of this._colors)if(n.every(((e,n)=>e===t[n])))return Wae._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?uae.makeHexColor(...t):e}}class $ae{#w=new AbortController;#S=null;#x=new Map;#T=new Map;#O=null;#A=null;#R=null;#N=new jae;#_=null;#D=null;#P=0;#F=new Set;#I=null;#B=null;#j=new Set;_editorUndoBar=null;#U=!1;#W=!1;#$=!1;#q=null;#G=null;#Y=null;#K=null;#X=!1;#Q=null;#J=new Iae;#Z=!1;#ee=!1;#te=null;#ne=null;#re=null;#ae=null;#oe=Pre.NONE;#ce=new Set;#ie=null;#le=null;#se=null;#he={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#de=[0,0];#ue=null;#me=null;#pe=null;#ve=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=$ae.prototype,t=e=>e.#me.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&e.hasSomethingToControl(),n=(e,{target:t})=>{if(t instanceof HTMLInputElement){const{type:e}=t;return"text"!==e&&"number"!==e}return!0},r=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return Jre(this,"_keyboardManager",new Uae([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#me.contains(t)&&!e.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#me.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-r,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-a,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[r,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[a,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-r],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-a],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,r],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,a],checker:t}]]))}constructor(e,t,n,r,a,o,c,i,l,s,h,d,u){const m=this._signal=this.#w.signal;this.#me=e,this.#pe=t,this.#O=n,this._eventBus=r,r._on("editingaction",this.onEditingAction.bind(this),{signal:m}),r._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),r._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),r._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),r._on("setpreference",this.onSetPreference.bind(this),{signal:m}),r._on("switchannotationeditorparams",(e=>this.updateParams(e.type,e.value)),{signal:m}),this.#fe(),this.#ze(),this.#ge(),this.#A=a.annotationStorage,this.#q=a.filterFactory,this.#le=o,this.#K=c||null,this.#U=i,this.#W=l,this.#$=s,this.#ae=h||null,this.viewParameters={realScale:gae.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=d||null,this._supportsPinchToZoom=!1!==u}destroy(){this.#ve?.resolve(),this.#ve=null,this.#w?.abort(),this.#w=null,this._signal=null;for(const e of this.#T.values())e.destroy();this.#T.clear(),this.#x.clear(),this.#j.clear(),this.#S=null,this.#ce.clear(),this.#N.destroy(),this.#O?.destroy(),this.#Q?.hide(),this.#Q=null,this.#G&&(clearTimeout(this.#G),this.#G=null),this.#ue&&(clearTimeout(this.#ue),this.#ue=null),this._editorUndoBar?.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#ae}get useNewAltTextFlow(){return this.#W}get useNewAltTextWhenAddingImage(){return this.#$}get hcmFilter(){return Jre(this,"hcmFilter",this.#le?this.#q.addHCMFilter(this.#le.foreground,this.#le.background):"none")}get direction(){return Jre(this,"direction",getComputedStyle(this.#me).direction)}get highlightColors(){return Jre(this,"highlightColors",this.#K?new Map(this.#K.split(",").map((e=>e.split("=").map((e=>e.trim()))))):null)}get highlightColorNames(){return Jre(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(e=>e.reverse()))):null)}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#D=e}setMainHighlightColorPicker(e){this.#re=e}editAltText(e,t=!1){this.#O?.editAltText(this,e,t)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){"enableNewAltTextWhenAddingImage"===e&&(this.#$=t)}onPageChanging({pageNumber:e}){this.#P=e-1}focusMainContainer(){this.#me.focus()}findParent(e,t){for(const n of this.#T.values()){const{x:r,y:a,width:o,height:c}=n.div.getBoundingClientRect();if(e>=r&&e<=r+o&&t>=a&&t<=a+c)return n}return null}disableUserSelect(e=!1){this.#pe.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#j.add(e)}removeShouldRescale(e){this.#j.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*gae.PDF_TO_CSS_UNITS;for(const e of this.#j)e.onScaleChanging();this.#D?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#ye({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#Me(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const t of this.#T.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:o}=t,c=t.toString(),i=this.#ye(t).closest(".textLayer"),l=this.getSelectionBoxes(i);if(!l)return;t.empty();const s=this.#Me(i),h=this.#oe===Pre.NONE,d=()=>{s?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:o,text:c}),h&&this.showAllEditors("highlight",!0,!0)};h?this.switchToMode(Pre.HIGHLIGHT,d):d()}#Ee(){const e=document.getSelection();if(!e||e.isCollapsed)return;const t=this.#ye(e).closest(".textLayer"),n=this.getSelectionBoxes(t);n&&(this.#Q||=new Pae(this),this.#Q.show(t,n,"ltr"===this.direction))}addToAnnotationStorage(e){e.isEmpty()||!this.#A||this.#A.has(e.id)||this.#A.setValue(e.id,e)}#be(){const e=document.getSelection();if(!e||e.isCollapsed)return void(this.#ie&&(this.#Q?.hide(),this.#ie=null,this.#He({hasSelectedText:!1})));const{anchorNode:t}=e;if(t===this.#ie)return;const n=this.#ye(e).closest(".textLayer");if(n){if(this.#Q?.hide(),this.#ie=t,this.#He({hasSelectedText:!0}),(this.#oe===Pre.HIGHLIGHT||this.#oe===Pre.NONE)&&(this.#oe===Pre.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#X=this.isShiftKeyDown,!this.isShiftKeyDown)){const e=this.#oe===Pre.HIGHLIGHT?this.#Me(n):null;e?.toggleDrawing();const t=new AbortController,r=this.combinedSignal(t),a=n=>{"pointerup"===n.type&&0!==n.button||(t.abort(),e?.toggleDrawing(!0),"pointerup"===n.type&&this.#Ve("main_toolbar"))};window.addEventListener("pointerup",a,{signal:r}),window.addEventListener("blur",a,{signal:r})}}else this.#ie&&(this.#Q?.hide(),this.#ie=null,this.#He({hasSelectedText:!1}))}#Ve(e=""){this.#oe===Pre.HIGHLIGHT?this.highlightSelection(e):this.#U&&this.#Ee()}#fe(){document.addEventListener("selectionchange",this.#be.bind(this),{signal:this._signal})}#Ce(){if(this.#Y)return;this.#Y=new AbortController;const e=this.combinedSignal(this.#Y);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#Le(){this.#Y?.abort(),this.#Y=null}blur(){if(this.isShiftKeyDown=!1,this.#X&&(this.#X=!1,this.#Ve("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of this.#ce)if(t.div.contains(e)){this.#ne=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#ne)return;const[e,t]=this.#ne;this.#ne=null,t.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),t.focus()}#ge(){if(this.#te)return;this.#te=new AbortController;const e=this.combinedSignal(this.#te);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#ke(){this.#te?.abort(),this.#te=null}#we(){if(this.#_)return;this.#_=new AbortController;const e=this.combinedSignal(this.#_);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#Se(){this.#_?.abort(),this.#_=null}#ze(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#ge(),this.#we()}removeEditListeners(){this.#ke(),this.#Se()}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const n of this.#B)if(n.isHandlingMimeForPasting(t))return e.dataTransfer.dropEffect="copy",void e.preventDefault()}drop(e){for(const t of e.dataTransfer.items)for(const n of this.#B)if(n.isHandlingMimeForPasting(t.type))return n.paste(t,this.currentLayer),void e.preventDefault()}copy(e){if(e.preventDefault(),this.#S?.commitOrRemove(),!this.hasSelection)return;const t=[];for(const e of this.#ce){const n=e.serialize(!0);n&&t.push(n)}0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const e of t.items)for(const t of this.#B)if(t.isHandlingMimeForPasting(e.type))return void t.paste(e,this.currentLayer);let n=t.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(e){return void Yre(`paste: "${e.message}".`)}if(!Array.isArray(n))return;this.unselectAll();const r=this.currentLayer;try{const e=[];for(const t of n){const n=await r.deserialize(t);if(!n)return;e.push(n)}const t=()=>{for(const t of e)this.#xe(t);this.#Te(e)},a=()=>{for(const t of e)t.remove()};this.addCommands({cmd:t,undo:a,mustExec:!0})}catch(e){Yre(`paste: "${e.message}".`)}}keydown(e){this.isShiftKeyDown||"Shift"!==e.key||(this.isShiftKeyDown=!0),this.#oe===Pre.NONE||this.isEditorHandlingKeyboard||$ae._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&"Shift"===e.key&&(this.isShiftKeyDown=!1,this.#X&&(this.#X=!1,this.#Ve("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#He(e){Object.entries(e).some((([e,t])=>this.#he[e]!==t))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#he,e)}),this.#oe===Pre.HIGHLIGHT&&!1===e.hasSelectedEditor&&this.#Oe([[Fre.HIGHLIGHT_FREE,!0]]))}#Oe(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#Ce(),this.#we(),this.#He({isEditing:this.#oe!==Pre.NONE,isEmpty:this.#Ae(),hasSomethingToUndo:this.#N.hasSomethingToUndo(),hasSomethingToRedo:this.#N.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Le(),this.#Se(),this.#He({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#B){this.#B=e;for(const e of this.#B)this.#Oe(e.defaultPropertiesToUpdate)}}getId(){return this.#J.id}get currentLayer(){return this.#T.get(this.#P)}getLayer(e){return this.#T.get(e)}get currentPageIndex(){return this.#P}addLayer(e){this.#T.set(e.pageIndex,e),this.#Z?e.enable():e.disable()}removeLayer(e){this.#T.delete(e.pageIndex)}async updateMode(e,t=null,n=!1){if(this.#oe!==e&&(!this.#ve||(await this.#ve.promise,this.#ve))){if(this.#ve=Promise.withResolvers(),this.#oe=e,e===Pre.NONE)return this.setEditingState(!1),this.#Re(),this._editorUndoBar?.hide(),void this.#ve.resolve();this.setEditingState(!0),await this.#Ne(),this.unselectAll();for(const t of this.#T.values())t.updateMode(e);if(!t)return n&&this.addNewEditorFromKeyboard(),void this.#ve.resolve();for(const e of this.#x.values())e.annotationElementId===t?(this.setSelected(e),e.enterInEditMode()):e.unselect();this.#ve.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==this.#oe&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#B){switch(e){case Fre.CREATE:return void this.currentLayer.addNewEditor();case Fre.HIGHLIGHT_DEFAULT_COLOR:this.#re?.updateColor(t);break;case Fre.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#se||=new Map).set(e,t),this.showAllEditors("highlight",t)}for(const n of this.#ce)n.updateParams(e,t);for(const n of this.#B)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(const n of this.#x.values())n.editorType===e&&n.show(t);(this.#se?.get(Fre.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#Oe([[Fre.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#ee!==e){this.#ee=e;for(const t of this.#T.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}async#Ne(){if(!this.#Z){this.#Z=!0;const e=[];for(const t of this.#T.values())e.push(t.enable());await Promise.all(e);for(const e of this.#x.values())e.enable()}}#Re(){if(this.unselectAll(),this.#Z){this.#Z=!1;for(const e of this.#T.values())e.disable();for(const e of this.#x.values())e.disable()}}getEditors(e){const t=[];for(const n of this.#x.values())n.pageIndex===e&&t.push(n);return t}getEditor(e){return this.#x.get(e)}addEditor(e){this.#x.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#G&&clearTimeout(this.#G),this.#G=setTimeout((()=>{this.focusMainContainer(),this.#G=null}),0)),this.#x.delete(e.id),this.unselect(e),e.annotationElementId&&this.#F.has(e.annotationElementId)||this.#A?.remove(e.id)}addDeletedAnnotationElement(e){this.#F.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#F.has(e)}removeDeletedAnnotationElement(e){this.#F.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#xe(e){const t=this.#T.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#S!==e&&(this.#S=e,e&&this.#Oe(e.propertiesToUpdate))}get#_e(){let e=null;for(e of this.#ce);return e}updateUI(e){this.#_e===e&&this.#Oe(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#Oe(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#ce.has(e))return this.#ce.delete(e),e.unselect(),void this.#He({hasSelectedEditor:this.hasSelection});this.#ce.add(e),e.select(),this.#Oe(e.propertiesToUpdate),this.#He({hasSelectedEditor:!0})}setSelected(e){this.#D?.commitOrRemove();for(const t of this.#ce)t!==e&&t.unselect();this.#ce.clear(),this.#ce.add(e),e.select(),this.#Oe(e.propertiesToUpdate),this.#He({hasSelectedEditor:!0})}isSelected(e){return this.#ce.has(e)}get firstSelectedEditor(){return this.#ce.values().next().value}unselect(e){e.unselect(),this.#ce.delete(e),this.#He({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#ce.size}get isEnterHandled(){return 1===this.#ce.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#N.undo(),this.#He({hasSomethingToUndo:this.#N.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#Ae()}),this._editorUndoBar?.hide()}redo(){this.#N.redo(),this.#He({hasSomethingToUndo:!0,hasSomethingToRedo:this.#N.hasSomethingToRedo(),isEmpty:this.#Ae()})}addCommands(e){this.#N.add(e),this.#He({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#Ae()})}cleanUndoStack(e){this.#N.cleanType(e)}#Ae(){if(0===this.#x.size)return!0;if(1===this.#x.size)for(const e of this.#x.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();const e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...this.#ce],n=()=>{for(const e of t)this.#xe(e)};this.addCommands({cmd:()=>{this._editorUndoBar?.show(n,1===t.length?t[0].editorType:t.length);for(const e of t)e.remove()},undo:n,mustExec:!0})}commitOrRemove(){this.#S?.commitOrRemove()}hasSomethingToControl(){return this.#S||this.hasSelection}#Te(e){for(const e of this.#ce)e.unselect();this.#ce.clear();for(const t of e)t.isEmpty()||(this.#ce.add(t),t.select());this.#He({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#ce)e.commit();this.#Te(this.#x.values())}unselectAll(){if((!this.#S||(this.#S.commitOrRemove(),this.#oe===Pre.NONE))&&!this.#D?.commitOrRemove()&&this.hasSelection){for(const e of this.#ce)e.unselect();this.#ce.clear(),this.#He({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#de[0]+=e,this.#de[1]+=t;const[r,a]=this.#de,o=[...this.#ce];this.#ue&&clearTimeout(this.#ue),this.#ue=setTimeout((()=>{this.#ue=null,this.#de[0]=this.#de[1]=0,this.addCommands({cmd:()=>{for(const e of o)this.#x.has(e.id)&&e.translateInPage(r,a)},undo:()=>{for(const e of o)this.#x.has(e.id)&&e.translateInPage(-r,-a)},mustExec:!1})}),1e3);for(const n of o)n.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#I=new Map;for(const e of this.#ce)this.#I.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#I)return!1;this.disableUserSelect(!1);const e=this.#I;this.#I=null;let t=!1;for(const[{x:n,y:r,pageIndex:a},o]of e)o.newX=n,o.newY=r,o.newPageIndex=a,t||=n!==o.savedX||r!==o.savedY||a!==o.savedPageIndex;if(!t)return!1;const n=(e,t,n,r)=>{if(this.#x.has(e.id)){const a=this.#T.get(r);a?e._setParentAndPosition(a,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(const[t,{newX:r,newY:a,newPageIndex:o}]of e)n(t,r,a,o)},undo:()=>{for(const[t,{savedX:r,savedY:a,savedPageIndex:o}]of e)n(t,r,a,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#I)for(const n of this.#I.keys())n.drag(e,t)}rebuild(e){if(null===e.parent){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#ce.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#S===e}getActive(){return this.#S}getMode(){return this.#oe}get imageManager(){return Jre(this,"imageManager",new Bae)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let n=0,r=t.rangeCount;n<r;n++)if(!e.contains(t.getRangeAt(n).commonAncestorContainer))return null;const{x:n,y:r,width:a,height:o}=e.getBoundingClientRect();let c;switch(e.getAttribute("data-main-rotation")){case"90":c=(e,t,c,i)=>({x:(t-r)/o,y:1-(e+c-n)/a,width:i/o,height:c/a});break;case"180":c=(e,t,c,i)=>({x:1-(e+c-n)/a,y:1-(t+i-r)/o,width:c/a,height:i/o});break;case"270":c=(e,t,c,i)=>({x:1-(t+i-r)/o,y:(e-n)/a,width:i/o,height:c/a});break;default:c=(e,t,c,i)=>({x:(e-n)/a,y:(t-r)/o,width:c/a,height:i/o})}const i=[];for(let e=0,n=t.rangeCount;e<n;e++){const n=t.getRangeAt(e);if(!n.collapsed)for(const{x:e,y:t,width:r,height:a}of n.getClientRects())0!==r&&0!==a&&i.push(c(e,t,r,a))}return 0===i.length?null:i}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#R||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#R?.delete(e)}renderAnnotationElement(e){const t=this.#R?.get(e.data.id);if(!t)return;const n=this.#A.getRawValue(t);n&&(this.#oe!==Pre.NONE||n.hasBeenModified)&&n.renderAnnotationElement(e)}}class qae{#i=null;#De=!1;#Pe=null;#Fe=null;#Ie=null;#Be=null;#je=!1;#Ue=null;#o=null;#We=null;#$e=null;#qe=!1;static#Ge=null;static _l10n=null;constructor(e){this.#o=e,this.#qe=e._uiManager.useNewAltTextFlow,qae.#Ge||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){qae._l10n??=e}async render(){const e=this.#Pe=document.createElement("button");e.className="altText",e.tabIndex="0";const t=this.#Fe=document.createElement("span");e.append(t),this.#qe?(e.classList.add("new"),e.setAttribute("data-l10n-id",qae.#Ge.missing),t.setAttribute("data-l10n-id",qae.#Ge["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const n=this.#o._uiManager._signal;e.addEventListener("contextmenu",wae,{signal:n}),e.addEventListener("pointerdown",(e=>e.stopPropagation()),{signal:n});const r=e=>{e.preventDefault(),this.#o._uiManager.editAltText(this.#o),this.#qe&&this.#o._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#Ye}})};return e.addEventListener("click",r,{capture:!0,signal:n}),e.addEventListener("keydown",(t=>{t.target===e&&"Enter"===t.key&&(this.#je=!0,r(t))}),{signal:n}),await this.#Ke(),e}get#Ye(){return(this.#i?"added":null===this.#i&&this.guessedText&&"review")||"missing"}finish(){this.#Pe&&(this.#Pe.focus({focusVisible:this.#je}),this.#je=!1)}isEmpty(){return this.#qe?null===this.#i:!this.#i&&!this.#De}hasData(){return this.#qe?null!==this.#i||!!this.#We:this.isEmpty()}get guessedText(){return this.#We}async setGuessedText(e){null===this.#i&&(this.#We=e,this.#$e=await qae._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#Ke())}toggleAltTextBadge(e=!1){if(!this.#qe||this.#i)return this.#Ue?.remove(),void(this.#Ue=null);if(!this.#Ue){const e=this.#Ue=document.createElement("div");e.className="noAltTextBadge",this.#o.div.append(e)}this.#Ue.classList.toggle("hidden",!e)}serialize(e){let t=this.#i;return e||this.#We!==t||(t=this.#$e),{altText:t,decorative:this.#De,guessedText:this.#We,textWithDisclaimer:this.#$e}}get data(){return{altText:this.#i,decorative:this.#De}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:r,cancel:a=!1}){n&&(this.#We=n,this.#$e=r),this.#i===e&&this.#De===t||(a||(this.#i=e,this.#De=t),this.#Ke())}toggle(e=!1){this.#Pe&&(!e&&this.#Be&&(clearTimeout(this.#Be),this.#Be=null),this.#Pe.disabled=!e)}shown(){this.#o._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#Ye}})}destroy(){this.#Pe?.remove(),this.#Pe=null,this.#Fe=null,this.#Ie=null,this.#Ue?.remove(),this.#Ue=null}async#Ke(){const e=this.#Pe;if(!e)return;if(this.#qe){if(e.classList.toggle("done",!!this.#i),e.setAttribute("data-l10n-id",qae.#Ge[this.#Ye]),this.#Fe?.setAttribute("data-l10n-id",qae.#Ge[`${this.#Ye}-label`]),!this.#i)return void this.#Ie?.remove()}else{if(!this.#i&&!this.#De)return e.classList.remove("done"),void this.#Ie?.remove();e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=this.#Ie;if(!t){this.#Ie=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${this.#o.id}`;const n=100,r=this.#o._uiManager._signal;r.addEventListener("abort",(()=>{clearTimeout(this.#Be),this.#Be=null}),{once:!0}),e.addEventListener("mouseenter",(()=>{this.#Be=setTimeout((()=>{this.#Be=null,this.#Ie.classList.add("show"),this.#o._reportTelemetry({action:"alt_text_tooltip"})}),n)}),{signal:r}),e.addEventListener("mouseleave",(()=>{this.#Be&&(clearTimeout(this.#Be),this.#Be=null),this.#Ie?.classList.remove("show")}),{signal:r})}this.#De?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=this.#i),t.parentNode||e.append(t);const n=this.#o.getImageForAltText();n?.setAttribute("aria-describedby",t.id)}}class Gae{#me;#Xe=!1;#Qe=null;#Je;#Ze;#et;#tt;#nt;#rt=null;#at;#ot=null;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:r=null,onPinching:a=null,onPinchEnd:o=null,signal:c}){this.#me=e,this.#Qe=n,this.#Je=t,this.#Ze=r,this.#et=a,this.#tt=o,this.#at=new AbortController,this.#nt=AbortSignal.any([c,this.#at.signal]),e.addEventListener("touchstart",this.#ct.bind(this),{passive:!1,signal:this.#nt})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return Jre(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}#ct(e){if(this.#Je?.()||e.touches.length<2)return;if(!this.#ot){this.#ot=new AbortController;const e=AbortSignal.any([this.#nt,this.#ot.signal]),t=this.#me,n={signal:e,passive:!1};t.addEventListener("touchmove",this.#it.bind(this),n),t.addEventListener("touchend",this.#lt.bind(this),n),t.addEventListener("touchcancel",this.#lt.bind(this),n),this.#Ze?.()}if(Sae(e),2!==e.touches.length||this.#Qe?.())return void(this.#rt=null);let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]),this.#rt={touch0X:t.screenX,touch0Y:t.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#it(e){if(!this.#rt||2!==e.touches.length)return;let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]);const{screenX:r,screenY:a}=t,{screenX:o,screenY:c}=n,i=this.#rt,{touch0X:l,touch0Y:s,touch1X:h,touch1Y:d}=i,u=h-l,m=d-s,p=o-r,v=c-a,f=Math.hypot(p,v)||1,z=Math.hypot(u,m)||1;if(!this.#Xe&&Math.abs(z-f)<=Gae.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(i.touch0X=r,i.touch0Y=a,i.touch1X=o,i.touch1Y=c,e.preventDefault(),!this.#Xe)return void(this.#Xe=!0);const g=[(r+o)/2,(a+c)/2];this.#et?.(g,z,f)}#lt(e){this.#ot.abort(),this.#ot=null,this.#tt?.(),this.#rt&&(e.preventDefault(),this.#rt=null,this.#Xe=!1)}destroy(){this.#at?.abort(),this.#at=null}}class Yae{#st=null;#ht=null;#i=null;#dt=!1;#ut=null;#mt="";#pt=!1;#vt=null;#ft=null;#zt=null;#gt=null;#yt="";#Mt=!1;#Et=null;#bt=!1;#Ht=!1;#Vt=!1;#Ct=null;#Lt=0;#kt=0;#wt=null;#St=null;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#xt=!1;#Tt=Yae._zIndex++;static _borderLineWidth=-1;static _colorManager=new Wae;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const e=Yae.prototype._resizeWithKeyboard,t=$ae.TRANSLATE_SMALL,n=$ae.TRANSLATE_BIG;return Jre(this,"_resizerKeyboardManager",new Uae([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],Yae.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:o}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[a,o];const[c,i]=this.parentDimensions;this.x=e.x/c,this.y=e.y/i,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return Jre(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new Kae({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(Yae._l10n??=e,Yae._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),-1!==Yae._borderLineWidth)return;const n=getComputedStyle(document.documentElement);Yae._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Kre("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#xt}set _isDraggable(e){this.#xt=e,this.div?.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(2*e),this.y+=this.width*e/(2*t);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(2*e),this.y-=this.width*e/(2*t);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#Tt}setParent(e){null!==e?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):this.#Ot(),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#Mt?this.#Mt=!1:this.parent.setSelected(this))}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const t=e.relatedTarget;t?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){const[a,o]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/a,this.y=(t+r)/o,this.fixAndSetPosition()}#At([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#At(this.parentDimensions,e,t)}translateInPage(e,t){this.#Et||=[this.x,this.y,this.width,this.height],this.#At(this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){this.#Et||=[this.x,this.y,this.width,this.height];const{div:n,parentDimensions:[r,a]}=this;if(this.x+=e/r,this.y+=t/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:c}=this;const[i,l]=this.getBaseTranslation();o+=i,c+=l;const{style:s}=n;s.left=`${(100*o).toFixed(2)}%`,s.top=`${(100*c).toFixed(2)}%`,this._onTranslating(o,c),n.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#Et&&(this.#Et[0]!==this.x||this.#Et[1]!==this.y)}get _hasBeenResized(){return!!this.#Et&&(this.#Et[2]!==this.width||this.#Et[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:n}=Yae,r=n/e,a=n/t;switch(this.rotation){case 90:return[-r,a];case 180:return[r,a];case 270:return[r,-a];default:return[-r,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[n,r]}=this;let{x:a,y:o,width:c,height:i}=this;if(c*=n,i*=r,a*=n,o*=r,this._mustFixPosition)switch(e){case 0:a=Math.max(0,Math.min(n-c,a)),o=Math.max(0,Math.min(r-i,o));break;case 90:a=Math.max(0,Math.min(n-i,a)),o=Math.min(r,Math.max(c,o));break;case 180:a=Math.min(n,Math.max(c,a)),o=Math.min(r,Math.max(i,o));break;case 270:a=Math.min(n,Math.max(i,a)),o=Math.max(0,Math.min(r-c,o))}this.x=a/=n,this.y=o/=r;const[l,s]=this.getBaseTranslation();a+=l,o+=s,t.left=`${(100*a).toFixed(2)}%`,t.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}static#Rt(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return Yae.#Rt(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return Yae.#Rt(e,t,360-this.parentRotation)}#Nt(e){switch(e){case 90:{const[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(e,t){const[n,r]=this.parentDimensions,{style:a}=this.div;a.width=`${(100*e/n).toFixed(2)}%`,this.#pt||(a.height=`${(100*t/r).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:n}=e,r=n.endsWith("%"),a=!this.#pt&&t.endsWith("%");if(r&&a)return;const[o,c]=this.parentDimensions;r||(e.width=`${(100*parseFloat(n)/o).toFixed(2)}%`),this.#pt||a||(e.height=`${(100*parseFloat(t)/c).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#_t(){if(this.#vt)return;this.#vt=document.createElement("div"),this.#vt.classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const n of e){const e=document.createElement("div");this.#vt.append(e),e.classList.add("resizer",n),e.setAttribute("data-resizer-name",n),e.addEventListener("pointerdown",this.#Dt.bind(this,n),{signal:t}),e.addEventListener("contextmenu",wae,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#vt)}#Dt(e,t){t.preventDefault();const{isMac:n}=hae.platform;if(0!==t.button||t.ctrlKey&&n)return;this.#i?.toggle(!1);const r=this._isDraggable;this._isDraggable=!1,this.#ft=[t.screenX,t.screenY];const a=new AbortController,o=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#Pt.bind(this,e),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",Sae,{passive:!1,signal:o}),window.addEventListener("contextmenu",wae,{signal:o}),this.#zt={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const c=this.parent.div.style.cursor,i=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const l=()=>{a.abort(),this.parent.togglePointerEvents(!0),this.#i?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=c,this.div.style.cursor=i,this.#Ft()};window.addEventListener("pointerup",l,{signal:o}),window.addEventListener("blur",l,{signal:o})}#It(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t;const[a,o]=this.parentDimensions;this.setDims(a*n,o*r),this.fixAndSetPosition(),this._onResized()}_onResized(){}#Ft(){if(!this.#zt)return;const{savedX:e,savedY:t,savedWidth:n,savedHeight:r}=this.#zt;this.#zt=null;const a=this.x,o=this.y,c=this.width,i=this.height;a===e&&o===t&&c===n&&i===r||this.addCommands({cmd:this.#It.bind(this,a,o,c,i),undo:this.#It.bind(this,e,t,n,r),mustExec:!0})}static _round(e){return Math.round(1e4*e)/1e4}#Pt(e,t){const[n,r]=this.parentDimensions,a=this.x,o=this.y,c=this.width,i=this.height,l=Yae.MIN_SIZE/n,s=Yae.MIN_SIZE/r,h=this.#Nt(this.rotation),d=(e,t)=>[h[0]*e+h[2]*t,h[1]*e+h[3]*t],u=this.#Nt(360-this.rotation);let m,p,v=!1,f=!1;switch(e){case"topLeft":v=!0,m=(e,t)=>[0,0],p=(e,t)=>[e,t];break;case"topMiddle":m=(e,t)=>[e/2,0],p=(e,t)=>[e/2,t];break;case"topRight":v=!0,m=(e,t)=>[e,0],p=(e,t)=>[0,t];break;case"middleRight":f=!0,m=(e,t)=>[e,t/2],p=(e,t)=>[0,t/2];break;case"bottomRight":v=!0,m=(e,t)=>[e,t],p=(e,t)=>[0,0];break;case"bottomMiddle":m=(e,t)=>[e/2,t],p=(e,t)=>[e/2,0];break;case"bottomLeft":v=!0,m=(e,t)=>[0,t],p=(e,t)=>[e,0];break;case"middleLeft":f=!0,m=(e,t)=>[0,t/2],p=(e,t)=>[e,t/2]}const z=m(c,i),g=p(c,i);let y=d(...g);const M=Yae._round(a+y[0]),E=Yae._round(o+y[1]);let b,H,V=1,C=1;if(t.fromKeyboard)({deltaX:b,deltaY:H}=t);else{const{screenX:e,screenY:n}=t,[r,a]=this.#ft;[b,H]=this.screenToPageTranslation(e-r,n-a),this.#ft[0]=e,this.#ft[1]=n}var L,k;if([b,H]=(L=b/n,k=H/r,[u[0]*L+u[2]*k,u[1]*L+u[3]*k]),v){const e=Math.hypot(c,i);V=C=Math.max(Math.min(Math.hypot(g[0]-z[0]-b,g[1]-z[1]-H)/e,1/c,1/i),l/c,s/i)}else f?V=Math.max(l,Math.min(1,Math.abs(g[0]-z[0]-b)))/c:C=Math.max(s,Math.min(1,Math.abs(g[1]-z[1]-H)))/i;const w=Yae._round(c*V),S=Yae._round(i*C);y=d(...p(w,S));const x=M-y[0],T=E-y[1];this.#Et||=[this.x,this.y,this.width,this.height],this.width=w,this.height=S,this.x=x,this.y=T,this.setDims(n*w,r*S),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#i?.finish()}async addEditToolbar(){return this._editToolbar||this.#Ht||(this._editToolbar=new Dae(this),this.div.append(this._editToolbar.render()),this.#i&&await this._editToolbar.addAltText(this.#i)),this._editToolbar}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#i?.destroy())}addContainer(e){const t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#i||(qae.initialize(Yae._l10n),this.#i=new qae(this),this.#st&&(this.#i.data=this.#st,this.#st=null),await this.addEditToolbar())}get altTextData(){return this.#i?.data}set altTextData(e){this.#i&&(this.#i.data=e)}get guessedAltText(){return this.#i?.guessedText}async setGuessedAltText(e){await(this.#i?.setGuessedText(e))}serializeAltText(e){return this.#i?.serialize(e)}hasAltText(){return!!this.#i&&!this.#i.isEmpty()}hasAltTextData(){return this.#i?.hasData()??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#dt?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.#Bt();const[e,t]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);const[n,r]=this.getInitialTranslation();return this.translate(n,r),Fae(this,this.div,["pointerdown"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#St||=new Gae({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#jt.bind(this),onPinching:this.#Ut.bind(this),onPinchEnd:this.#Wt.bind(this),signal:this._uiManager._signal})),this._uiManager._editorUndoBar?.hide(),this.div}#jt(){this.#zt={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#i?.toggle(!1),this.parent.togglePointerEvents(!1)}#Ut(e,t,n){let r=n/t*.7+1-.7;if(1===r)return;const a=this.#Nt(this.rotation),o=(e,t)=>[a[0]*e+a[2]*t,a[1]*e+a[3]*t],[c,i]=this.parentDimensions,l=this.x,s=this.y,h=this.width,d=this.height,u=Yae.MIN_SIZE/c,m=Yae.MIN_SIZE/i;r=Math.max(Math.min(r,1/h,1/d),u/h,m/d);const p=Yae._round(h*r),v=Yae._round(d*r);if(p===h&&v===d)return;this.#Et||=[l,s,h,d];const f=o(h/2,d/2),z=Yae._round(l+f[0]),g=Yae._round(s+f[1]),y=o(p/2,v/2);this.x=z-y[0],this.y=g-y[1],this.width=p,this.height=v,this.setDims(c*p,i*v),this.fixAndSetPosition(),this._onResizing()}#Wt(){this.#i?.toggle(!0),this.parent.togglePointerEvents(!0),this.#Ft()}pointerdown(e){const{isMac:t}=hae.platform;0!==e.button||e.ctrlKey&&t?e.preventDefault():(this.#Mt=!0,this._isDraggable?this.#$t(e):this.#qt(e))}get isSelected(){return this._uiManager.isSelected(this)}#qt(e){const{isMac:t}=hae.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#$t(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1;const r=new AbortController,a=this._uiManager.combinedSignal(r),o={capture:!0,passive:!1,signal:a},c=e=>{r.abort(),this.#ut=null,this.#Mt=!1,this._uiManager.endDragSession()||this.#qt(e),n&&this._onStopDragging()};t&&(this.#Lt=e.clientX,this.#kt=e.clientY,this.#ut=e.pointerId,this.#mt=e.pointerType,window.addEventListener("pointermove",(e=>{n||(n=!0,this._onStartDragging());const{clientX:t,clientY:r,pointerId:a}=e;if(a!==this.#ut)return void Sae(e);const[o,c]=this.screenToPageTranslation(t-this.#Lt,r-this.#kt);this.#Lt=t,this.#kt=r,this._uiManager.dragSelectedEditors(o,c)}),o),window.addEventListener("touchmove",Sae,o),window.addEventListener("pointerdown",(e=>{e.pointerType===this.#mt&&(this.#St||e.isPrimary)&&c(e),Sae(e)}),o));const i=e=>{this.#ut&&this.#ut!==e.pointerId?Sae(e):c(e)};window.addEventListener("pointerup",i,{signal:a}),window.addEventListener("blur",i,{signal:a})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#Ct&&clearTimeout(this.#Ct),this.#Ct=setTimeout((()=>{this.#Ct=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){const r=this.parentScale,[a,o]=this.pageDimensions,[c,i]=this.pageTranslation,l=e/r,s=t/r,h=this.x*a,d=this.y*o,u=this.width*a,m=this.height*o;switch(n){case 0:return[h+l+c,o-d-s-m+i,h+l+u+c,o-d-s+i];case 90:return[h+s+c,o-d+l+i,h+s+m+c,o-d+l+u+i];case 180:return[h-l-u+c,o-d+s+i,h-l+c,o-d+s+m+i];case 270:return[h-s-m+c,o-d-l-u+i,h-s+c,o-d-l+i];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[n,r,a,o]=e,c=a-n,i=o-r;switch(this.rotation){case 0:return[n,t-o,c,i];case 90:return[n,t-r,i,c];case 180:return[a,t-r,c,i];case 270:return[a,t-o,i,c];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){this.#Ht=!0}disableEditMode(){this.#Ht=!1}isInEditMode(){return this.#Ht}shouldGetKeyboardEvents(){return this.#Vt}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:a,innerWidth:o}=window;return t<o&&r>0&&e<a&&n>0}#Bt(){if(this.#gt||!this.div)return;this.#gt=new AbortController;const e=this._uiManager.combinedSignal(this.#gt);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#Bt()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,t=null){Kre("An editor must be serializable")}static async deserialize(e,t,n){const r=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:n});r.rotation=e.rotation,r.#st=e.accessibilityData;const[a,o]=r.pageDimensions,[c,i,l,s]=r.getRectInCurrentCoords(e.rect,o);return r.x=c/a,r.y=i/o,r.width=l/a,r.height=s/o,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#gt?.abort(),this.#gt=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#Ct&&(clearTimeout(this.#Ct),this.#Ct=null),this.#Ot(),this.removeEditToolbar(),this.#wt){for(const e of this.#wt.values())clearTimeout(e);this.#wt=null}this.parent=null,this.#St?.destroy(),this.#St=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#_t(),this.#vt.classList.remove("hidden"),Fae(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||"Enter"!==e.key)return;this._uiManager.setSelected(this),this.#zt={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const t=this.#vt.children;if(!this.#ht){this.#ht=Array.from(t);const e=this.#Gt.bind(this),n=this.#Yt.bind(this),r=this._uiManager._signal;for(const t of this.#ht){const a=t.getAttribute("data-resizer-name");t.setAttribute("role","spinbutton"),t.addEventListener("keydown",e,{signal:r}),t.addEventListener("blur",n,{signal:r}),t.addEventListener("focus",this.#Kt.bind(this,a),{signal:r}),t.setAttribute("data-l10n-id",Yae._l10nResizer[a])}}const n=this.#ht[0];let r=0;for(const e of t){if(e===n)break;r++}const a=(360-this.rotation+this.parentRotation)%360/90*(this.#ht.length/4);if(a!==r){if(a<r)for(let e=0;e<r-a;e++)this.#vt.append(this.#vt.firstChild);else if(a>r)for(let e=0;e<a-r;e++)this.#vt.firstChild.before(this.#vt.lastChild);let e=0;for(const n of t){const t=this.#ht[e++].getAttribute("data-resizer-name");n.setAttribute("data-l10n-id",Yae._l10nResizer[t])}}this.#Xt(0),this.#Vt=!0,this.#vt.firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#Gt(e){Yae._resizerKeyboardManager.exec(this,e)}#Yt(e){this.#Vt&&e.relatedTarget?.parentNode!==this.#vt&&this.#Ot()}#Kt(e){this.#yt=this.#Vt?e:""}#Xt(e){if(this.#ht)for(const t of this.#ht)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#Vt&&this.#Pt(this.#yt,{deltaX:e,deltaY:t,fromKeyboard:!0})}#Ot(){this.#Vt=!1,this.#Xt(-1),this.#Ft()}_stopResizingWithKeyboard(){this.#Ot(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar?(this._editToolbar?.show(),this.#i?.toggleAltTextBadge(!1)):this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()}))}unselect(){this.#vt?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#i?.toggleAltTextBadge(!0)}updateParams(e,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#bt}set isEditing(e){this.#bt=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#pt=!0;const n=e/t,{style:r}=this.div;r.aspectRatio=n,r.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){this.#wt||=new Map;const{action:t}=e;let n=this.#wt.get(t);return n&&clearTimeout(n),n=setTimeout((()=>{this._reportTelemetry(e),this.#wt.delete(t),0===this.#wt.size&&(this.#wt=null)}),Yae._telemetryTimeout),void this.#wt.set(t,n)}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#dt=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#dt=!0}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(t){if("CANVAS"===t.nodeName){const e=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.before(t)}}else t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);return t}resetAnnotationElement(e){const{firstChild:t}=e.container;"DIV"===t?.nodeName&&t.classList.contains("annotationContent")&&t.remove()}}class Kae extends Yae{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Xae=3285377520,Qae=4294901760,Jae=65535;class Zae{constructor(e){this.h1=e?4294967295&e:Xae,this.h2=e?4294967295&e:Xae}update(e){let t,n;if("string"==typeof e){t=new Uint8Array(2*e.length),n=0;for(let r=0,a=e.length;r<a;r++){const a=e.charCodeAt(r);a<=255?t[n++]=a:(t[n++]=a>>>8,t[n++]=255&a)}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice(),n=t.byteLength}const r=n>>2,a=n-4*r,o=new Uint32Array(t.buffer,0,r);let c=0,i=0,l=this.h1,s=this.h2;const h=3432918353,d=461845907,u=11601,m=13715;for(let e=0;e<r;e++)1&e?(c=o[e],c=c*h&Qae|c*u&Jae,c=c<<15|c>>>17,c=c*d&Qae|c*m&Jae,l^=c,l=l<<13|l>>>19,l=5*l+3864292196):(i=o[e],i=i*h&Qae|i*u&Jae,i=i<<15|i>>>17,i=i*d&Qae|i*m&Jae,s^=i,s=s<<13|s>>>19,s=5*s+3864292196);switch(c=0,a){case 3:c^=t[4*r+2]<<16;case 2:c^=t[4*r+1]<<8;case 1:c^=t[4*r],c=c*h&Qae|c*u&Jae,c=c<<15|c>>>17,c=c*d&Qae|c*m&Jae,1&r?l^=c:s^=c}this.h1=l,this.h2=s}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=3981806797*e&Qae|36045*e&Jae,t=4283543511*t&Qae|(2950163797*(t<<16|e>>>16)&Qae)>>>16,e^=t>>>1,e=444984403*e&Qae|60499*e&Jae,t=3301882366*t&Qae|(3120437893*(t<<16|e>>>16)&Qae)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const eoe=Object.freeze({map:null,hash:"",transfer:void 0});class toe{#Qt=!1;#Jt=null;#Zt=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const n=this.#Zt.get(e);return void 0===n?t:Object.assign(t,n)}getRawValue(e){return this.#Zt.get(e)}remove(e){if(this.#Zt.delete(e),0===this.#Zt.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this.#Zt.values())if(e instanceof Yae)return;this.onAnnotationEditor(null)}}setValue(e,t){const n=this.#Zt.get(e);let r=!1;if(void 0!==n)for(const[e,a]of Object.entries(t))n[e]!==a&&(r=!0,n[e]=a);else r=!0,this.#Zt.set(e,t);r&&this.#en(),t instanceof Yae&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#Zt.has(e)}getAll(){return this.#Zt.size>0?sae(this.#Zt):null}setAll(e){for(const[t,n]of Object.entries(e))this.setValue(t,n)}get size(){return this.#Zt.size}#en(){this.#Qt||(this.#Qt=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#Qt&&(this.#Qt=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new noe(this)}get serializable(){if(0===this.#Zt.size)return eoe;const e=new Map,t=new Zae,n=[],r=Object.create(null);let a=!1;for(const[n,o]of this.#Zt){const c=o instanceof Yae?o.serialize(!1,r):o;c&&(e.set(n,c),t.update(`${n}:${JSON.stringify(c)}`),a||=!!c.bitmap)}if(a)for(const t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:eoe}get editorStats(){let e=null;const t=new Map;for(const n of this.#Zt.values()){if(!(n instanceof Yae))continue;const r=n.telemetryFinalData;if(!r)continue;const{type:a}=r;t.has(a)||t.set(a,Object.getPrototypeOf(n).constructor),e||=Object.create(null);const o=e[a]||=new Map;for(const[e,t]of Object.entries(r)){if("type"===e)continue;let n=o.get(e);n||(n=new Map,o.set(e,n));const r=n.get(t)??0;n.set(t,r+1)}}for(const[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){this.#Jt=null}get modifiedIds(){if(this.#Jt)return this.#Jt;const e=[];for(const t of this.#Zt.values())t instanceof Yae&&t.annotationElementId&&t.serialize()&&e.push(t.annotationElementId);return this.#Jt={ids:new Set(e),hash:e.join(",")}}}class noe extends toe{#tn;constructor(e){super();const{map:t,hash:n,transfer:r}=e.serializable,a=structuredClone(t,r?{transfer:r}:null);this.#tn={map:a,hash:n,transfer:r}}get print(){Kre("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#tn}get modifiedIds(){return Jre(this,"modifiedIds",{ids:new Set,hash:""})}}class roe{#nn=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#nn.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:t}){if(e&&!this.#nn.has(e.loadedName))if(Xre(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:r,style:a}=e,o=new FontFace(n,r,a);this.addNativeFontFace(o);try{await o.load(),this.#nn.add(n),t?.(e)}catch{Yre(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}}else Kre("Not implemented: loadSystemFont without the Font Loading API.")}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo)return void await this.loadSystemFont(e);if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw Yre(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((t=>{const n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)}))}}get isFontLoadingAPISupported(){return Jre(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let e=!1;return(Are||"undefined"!=typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),Jre(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,n={done:!1,complete:function(){for(Xre(!n.done,"completeRequest() cannot be called twice."),n.done=!0;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(n),n}get _loadTestFont(){return Jre(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function r(e,t,n,r){return e.substring(0,t)+r+e.substring(t+n)}let a,o;const c=this._document.createElement("canvas");c.width=1,c.height=1;const i=c.getContext("2d");let l=0;const s=`lt${Date.now()}${this.loadTestFontId++}`;let h=this._loadTestFont;h=r(h,976,s.length,s);const d=1482184792;let u=n(h,16);for(a=0,o=s.length-3;a<o;a+=4)u=u-d+n(s,a)|0;a<s.length&&(u=u-d+n(s+"XXX",a)|0),h=r(h,16,4,function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}(u));const m=`@font-face {font-family:"${s}";src:url(data:font/opentype;base64,${btoa(h)});}`;this.insertRule(m);const p=this._document.createElement("div");p.style.visibility="hidden",p.style.width=p.style.height="10px",p.style.position="absolute",p.style.top=p.style.left="0px";for(const t of[e.loadedName,s]){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,p.append(e)}this._document.body.append(p),function e(t,n){if(++l>30)return Yre("Load test font never loaded."),void n();i.font="30px "+t,i.fillText(".",0,20),i.getImageData(0,0,1,1).data[3]>0?n():setTimeout(e.bind(null,t,n))}(s,(()=>{p.remove(),t.complete()}))}}class aoe{constructor(e,{disableFontFace:t=!1,fontExtraProperties:n=!1,inspectFont:r=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.disableFontFace=!0===t,this.fontExtraProperties=!0===n,this._inspectFont=r}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${t=this.data,Uint8Array.prototype.toBase64?t.toBase64():btoa(iae(t))});`;var t;let n;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${e}}`}else n=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this._inspectFont?.(this,e),n}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];const n=this.loadedName+"_path_"+t;let r;try{r=e.get(n)}catch(e){Yre(`getPathGenerator - ignoring character: "${e}".`)}const a=new Path2D(r||"");return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=a}}function ooe(){}function coe(e){if(e instanceof cae||e instanceof nae||e instanceof rae||e instanceof eae||e instanceof aae||e instanceof tae)return e;switch(e instanceof Error||"object"==typeof e&&null!==e||Kre('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new cae(e.message);case"InvalidPDFException":return new nae(e.message);case"MissingPDFException":return new rae(e.message);case"PasswordException":return new eae(e.message,e.code);case"UnexpectedResponseException":return new aae(e.message,e.status);case"UnknownErrorException":return new tae(e.message,e.details)}return new tae(e.message,e.toString())}class ioe{#rn=new AbortController;constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener("message",this.#an.bind(this),{signal:this.#rn.signal})}#an({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#on(e);if(e.callback){const t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],1===e.callback)n.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");n.reject(coe(e.reason))}return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const n=this.sourceName,r=e.sourceName,a=this.comObj;Promise.try(t,e.data).then((function(t){a.postMessage({sourceName:n,targetName:r,callback:1,callbackId:e.callbackId,data:t})}),(function(t){a.postMessage({sourceName:n,targetName:r,callback:2,callbackId:e.callbackId,reason:coe(t)})}))}else e.streamId?this.#cn(e):t(e.data)}on(e,t){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){const r=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[r]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(e){a.reject(e)}return a.promise}sendWithStream(e,t,n,r){const a=this.streamId++,o=this.sourceName,c=this.targetName,i=this.comObj;return new ReadableStream({start:n=>{const l=Promise.withResolvers();return this.streamControllers[a]={controller:n,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},i.postMessage({sourceName:o,targetName:c,action:e,streamId:a,data:t,desiredSize:n.desiredSize},r),l.promise},pull:e=>{const t=Promise.withResolvers();return this.streamControllers[a].pullCall=t,i.postMessage({sourceName:o,targetName:c,stream:6,streamId:a,desiredSize:e.desiredSize}),t.promise},cancel:e=>{Xre(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();return this.streamControllers[a].cancelCall=t,this.streamControllers[a].isClosed=!0,i.postMessage({sourceName:o,targetName:c,stream:1,streamId:a,reason:coe(e)}),t.promise}},n)}#cn(e){const t=e.streamId,n=this.sourceName,r=e.sourceName,a=this.comObj,o=this,c=this.actionHandler[e.action],i={enqueue(e,o=1,c){if(this.isCancelled)return;const i=this.desiredSize;this.desiredSize-=o,i>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:n,targetName:r,stream:4,streamId:t,chunk:e},c)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:r,stream:3,streamId:t}),delete o.streamSinks[t])},error(e){Xre(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:r,stream:5,streamId:t,reason:coe(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};i.sinkCapability.resolve(),i.ready=i.sinkCapability.promise,this.streamSinks[t]=i,Promise.try(c,e.data,i).then((function(){a.postMessage({sourceName:n,targetName:r,stream:8,streamId:t,success:!0})}),(function(e){a.postMessage({sourceName:n,targetName:r,stream:8,streamId:t,reason:coe(e)})}))}#on(e){const t=e.streamId,n=this.sourceName,r=e.sourceName,a=this.comObj,o=this.streamControllers[t],c=this.streamSinks[t];switch(e.stream){case 8:e.success?o.startCall.resolve():o.startCall.reject(coe(e.reason));break;case 7:e.success?o.pullCall.resolve():o.pullCall.reject(coe(e.reason));break;case 6:if(!c){a.postMessage({sourceName:n,targetName:r,stream:7,streamId:t,success:!0});break}c.desiredSize<=0&&e.desiredSize>0&&c.sinkCapability.resolve(),c.desiredSize=e.desiredSize,Promise.try(c.onPull||ooe).then((function(){a.postMessage({sourceName:n,targetName:r,stream:7,streamId:t,success:!0})}),(function(e){a.postMessage({sourceName:n,targetName:r,stream:7,streamId:t,reason:coe(e)})}));break;case 4:if(Xre(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case 3:if(Xre(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),this.#in(o,t);break;case 5:Xre(o,"error should have stream controller"),o.controller.error(coe(e.reason)),this.#in(o,t);break;case 2:e.success?o.cancelCall.resolve():o.cancelCall.reject(coe(e.reason)),this.#in(o,t);break;case 1:if(!c)break;const i=coe(e.reason);Promise.try(c.onCancel||ooe,i).then((function(){a.postMessage({sourceName:n,targetName:r,stream:2,streamId:t,success:!0})}),(function(e){a.postMessage({sourceName:n,targetName:r,stream:2,streamId:t,reason:coe(e)})})),c.sinkCapability.reject(i),c.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#in(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#rn?.abort(),this.#rn=null}}class loe{#ln=!1;constructor({enableHWA:e=!1}){this.#ln=e}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#ln})}}reset(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Kre("Abstract method `_createCanvas` called.")}}class soe{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then((e=>({cMapData:e,isCompressed:this.isCompressed}))).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}async _fetch(e){Kre("Abstract method `_fetch` called.")}}class hoe extends soe{async _fetch(e){const t=await yae(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):lae(t)}}class doe{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,n,r,a){return"none"}destroy(e=!1){}}class uoe{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}async _fetch(e){Kre("Abstract method `_fetch` called.")}}class moe extends uoe{async _fetch(e){const t=await yae(e,"arraybuffer");return new Uint8Array(t)}}async function poe(e){const t=St.getBuiltinModule("fs"),n=await t.promises.readFile(e);return new Uint8Array(n)}Are&&Yre("Please use the `legacy` build in Node.js environments.");const voe="Fill",foe="Stroke",zoe="Shading";function goe(e,t){if(!t)return;const n=t[2]-t[0],r=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],n,r),e.clip(a)}class yoe{getPattern(){Kre("Abstract method `getPattern` called.")}}class Moe extends yoe{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,n,r){let a;if(r===foe||r===voe){const o=t.current.getClippedPathBoundingBox(r,Aae(e))||[0,0,0,0],c=Math.ceil(o[2]-o[0])||1,i=Math.ceil(o[3]-o[1])||1,l=t.cachedCanvases.getCanvas("pattern",c,i),s=l.context;s.clearRect(0,0,s.canvas.width,s.canvas.height),s.beginPath(),s.rect(0,0,s.canvas.width,s.canvas.height),s.translate(-o[0],-o[1]),n=uae.transform(n,[1,0,0,1,o[0],o[1]]),s.transform(...t.baseTransform),this.matrix&&s.transform(...this.matrix),goe(s,this._bbox),s.fillStyle=this._createGradient(s),s.fill(),a=e.createPattern(l.canvas,"no-repeat");const h=new DOMMatrix(n);a.setTransform(h)}else goe(e,this._bbox),a=this._createGradient(e);return a}}function Eoe(e,t,n,r,a,o,c,i){const l=t.coords,s=t.colors,h=e.data,d=4*e.width;let u;l[n+1]>l[r+1]&&(u=n,n=r,r=u,u=o,o=c,c=u),l[r+1]>l[a+1]&&(u=r,r=a,a=u,u=c,c=i,i=u),l[n+1]>l[r+1]&&(u=n,n=r,r=u,u=o,o=c,c=u);const m=(l[n]+t.offsetX)*t.scaleX,p=(l[n+1]+t.offsetY)*t.scaleY,v=(l[r]+t.offsetX)*t.scaleX,f=(l[r+1]+t.offsetY)*t.scaleY,z=(l[a]+t.offsetX)*t.scaleX,g=(l[a+1]+t.offsetY)*t.scaleY;if(p>=g)return;const y=s[o],M=s[o+1],E=s[o+2],b=s[c],H=s[c+1],V=s[c+2],C=s[i],L=s[i+1],k=s[i+2],w=Math.round(p),S=Math.round(g);let x,T,O,A,R,N,_,D;for(let e=w;e<=S;e++){if(e<f){const t=e<p?0:(p-e)/(p-f);x=m-(m-v)*t,T=y-(y-b)*t,O=M-(M-H)*t,A=E-(E-V)*t}else{let t;t=e>g?1:f===g?0:(f-e)/(f-g),x=v-(v-z)*t,T=b-(b-C)*t,O=H-(H-L)*t,A=V-(V-k)*t}let t;t=e<p?0:e>g?1:(p-e)/(p-g),R=m-(m-z)*t,N=y-(y-C)*t,_=M-(M-L)*t,D=E-(E-k)*t;const n=Math.round(Math.min(x,R)),r=Math.round(Math.max(x,R));let a=d*e+4*n;for(let e=n;e<=r;e++)t=(x-e)/(x-R),t<0?t=0:t>1&&(t=1),h[a++]=T-(T-N)*t|0,h[a++]=O-(O-_)*t|0,h[a++]=A-(A-D)*t|0,h[a++]=255}}function boe(e,t,n){const r=t.coords,a=t.colors;let o,c;switch(t.type){case"lattice":const i=t.verticesPerRow,l=Math.floor(r.length/i)-1,s=i-1;for(o=0;o<l;o++){let t=o*i;for(let o=0;o<s;o++,t++)Eoe(e,n,r[t],r[t+1],r[t+i],a[t],a[t+1],a[t+i]),Eoe(e,n,r[t+i+1],r[t+1],r[t+i],a[t+i+1],a[t+1],a[t+i])}break;case"triangles":for(o=0,c=r.length;o<c;o+=3)Eoe(e,n,r[o],r[o+1],r[o+2],a[o],a[o+1],a[o+2]);break;default:throw new Error("illegal figure")}}class Hoe extends yoe{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,n){const r=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),o=Math.ceil(this._bounds[2])-r,c=Math.ceil(this._bounds[3])-a,i=Math.min(Math.ceil(Math.abs(o*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(c*e[1]*1.1)),3e3),s=o/i,h=c/l,d={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-a,scaleX:1/s,scaleY:1/h},u=i+4,m=l+4,p=n.getCanvas("mesh",u,m),v=p.context,f=v.createImageData(i,l);if(t){const e=f.data;for(let n=0,r=e.length;n<r;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=255}for(const e of this._figures)boe(f,e,d);return v.putImageData(f,2,2),{canvas:p.canvas,offsetX:r-2*s,offsetY:a-2*h,scaleX:s,scaleY:h}}getPattern(e,t,n,r){let a;if(goe(e,this._bbox),r===zoe)a=uae.singularValueDecompose2dScale(Aae(e));else if(a=uae.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=uae.singularValueDecompose2dScale(this.matrix);a=[a[0]*e[0],a[1]*e[1]]}const o=this._createMeshCanvas(a,r===zoe?null:this._background,t.cachedCanvases);return r!==zoe&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(o.offsetX,o.offsetY),e.scale(o.scaleX,o.scaleY),e.createPattern(o.canvas,"no-repeat")}}class Voe extends yoe{getPattern(){return"hotpink"}}class Coe{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,r,a){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=n,this.canvasGraphicsFactory=r,this.baseTransform=a}createPatternCanvas(e){const{bbox:t,operatorList:n,paintType:r,tilingType:a,color:o,canvasGraphicsFactory:c}=this;let{xstep:i,ystep:l}=this;i=Math.abs(i),l=Math.abs(l),Gre("TilingType: "+a);const s=t[0],h=t[1],d=t[2],u=t[3],m=d-s,p=u-h,v=uae.singularValueDecompose2dScale(this.matrix),f=uae.singularValueDecompose2dScale(this.baseTransform),z=v[0]*f[0],g=v[1]*f[1];let y=m,M=p,E=!1,b=!1;const H=Math.ceil(i*z),V=Math.ceil(l*g);H>=Math.ceil(m*z)?y=i:E=!0,V>=Math.ceil(p*g)?M=l:b=!0;const C=this.getSizeAndScale(y,this.ctx.canvas.width,z),L=this.getSizeAndScale(M,this.ctx.canvas.height,g),k=e.cachedCanvases.getCanvas("pattern",C.size,L.size),w=k.context,S=c.createCanvasGraphics(w);if(S.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(S,r,o),w.translate(-C.scale*s,-L.scale*h),S.transform(C.scale,0,0,L.scale,0,0),w.save(),this.clipBbox(S,s,h,d,u),S.baseTransform=Aae(S.ctx),S.executeOperatorList(n),S.endDrawing(),w.restore(),E||b){const t=k.canvas;E&&(y=i),b&&(M=l);const n=this.getSizeAndScale(y,this.ctx.canvas.width,z),r=this.getSizeAndScale(M,this.ctx.canvas.height,g),a=n.size,o=r.size,c=e.cachedCanvases.getCanvas("pattern-workaround",a,o),d=c.context,u=E?Math.floor(m/i):0,v=b?Math.floor(p/l):0;for(let e=0;e<=u;e++)for(let n=0;n<=v;n++)d.drawImage(t,a*e,o*n,a,o,0,0,a,o);return{canvas:c.canvas,scaleX:n.scale,scaleY:r.scale,offsetX:s,offsetY:h}}return{canvas:k.canvas,scaleX:C.scale,scaleY:L.scale,offsetX:s,offsetY:h}}getSizeAndScale(e,t,n){const r=Math.max(Coe.MAX_PATTERN_SIZE,t);let a=Math.ceil(e*n);return a>=r?a=r:n=a/e,{scale:n,size:a}}clipBbox(e,t,n,r,a){const o=r-t,c=a-n;e.ctx.rect(t,n,o,c),e.current.updateRectMinMax(Aae(e.ctx),[t,n,r,a]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){const r=e.ctx,a=e.current;switch(t){case 1:const e=this.ctx;r.fillStyle=e.fillStyle,r.strokeStyle=e.strokeStyle,a.fillColor=e.fillStyle,a.strokeColor=e.strokeStyle;break;case 2:const o=uae.makeHexColor(n[0],n[1],n[2]);r.fillStyle=o,r.strokeStyle=o,a.fillColor=o,a.strokeColor=o;break;default:throw new oae(`Unsupported paint type: ${t}`)}}getPattern(e,t,n,r){let a=n;r!==zoe&&(a=uae.transform(a,t.baseTransform),this.matrix&&(a=uae.transform(a,this.matrix)));const o=this.createPatternCanvas(t);let c=new DOMMatrix(a);c=c.translate(o.offsetX,o.offsetY),c=c.scale(1/o.scaleX,1/o.scaleY);const i=e.createPattern(o.canvas,"repeat");return i.setTransform(c),i}}function Loe({src:e,srcPos:t=0,dest:n,width:r,height:a,nonBlackColor:o=4294967295,inverseDecode:c=!1}){const i=hae.isLittleEndian?4278190080:255,[l,s]=c?[o,i]:[i,o],h=r>>3,d=7&r,u=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r<a;r++){for(const r=t+h;t<r;t++){const r=t<u?e[t]:255;n[m++]=128&r?s:l,n[m++]=64&r?s:l,n[m++]=32&r?s:l,n[m++]=16&r?s:l,n[m++]=8&r?s:l,n[m++]=4&r?s:l,n[m++]=2&r?s:l,n[m++]=1&r?s:l}if(0===d)continue;const r=t<u?e[t++]:255;for(let e=0;e<d;e++)n[m++]=r&1<<7-e?s:l}return{srcPos:t,destPos:m}}const koe=16;class woe{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let r;return void 0!==this.cache[e]?(r=this.cache[e],this.canvasFactory.reset(r,t,n)):(r=this.canvasFactory.create(t,n),this.cache[e]=r),r}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function Soe(e,t,n,r,a,o,c,i,l,s){const[h,d,u,m,p,v]=Aae(e);if(0===d&&0===u){const f=c*h+p,z=Math.round(f),g=i*m+v,y=Math.round(g),M=(c+l)*h+p,E=Math.abs(Math.round(M)-z)||1,b=(i+s)*m+v,H=Math.abs(Math.round(b)-y)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(m),z,y),e.drawImage(t,n,r,a,o,0,0,E,H),e.setTransform(h,d,u,m,p,v),[E,H]}if(0===h&&0===m){const f=i*u+p,z=Math.round(f),g=c*d+v,y=Math.round(g),M=(i+s)*u+p,E=Math.abs(Math.round(M)-z)||1,b=(c+l)*d+v,H=Math.abs(Math.round(b)-y)||1;return e.setTransform(0,Math.sign(d),Math.sign(u),0,z,y),e.drawImage(t,n,r,a,o,0,0,H,E),e.setTransform(h,d,u,m,p,v),[H,E]}return e.drawImage(t,n,r,a,o,c,i,l,s),[Math.hypot(h,d)*l,Math.hypot(u,m)*s]}class xoe{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Rre,this.textMatrixScale=1,this.fontMatrix=Nre,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=0,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,n){[t,n]=uae.applyTransform([t,n],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(e,t){const n=uae.applyTransform(t,e),r=uae.applyTransform(t.slice(2),e),a=uae.applyTransform([t[0],t[3]],e),o=uae.applyTransform([t[2],t[1]],e);this.minX=Math.min(this.minX,n[0],r[0],a[0],o[0]),this.minY=Math.min(this.minY,n[1],r[1],a[1],o[1]),this.maxX=Math.max(this.maxX,n[0],r[0],a[0],o[0]),this.maxY=Math.max(this.maxY,n[1],r[1],a[1],o[1])}updateScalingPathMinMax(e,t){uae.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,n,r,a,o,c,i,l,s){const h=uae.bezierBoundingBox(t,n,r,a,o,c,i,l,s);s||this.updateRectMinMax(e,h)}getPathBoundingBox(e=voe,t=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(e===foe){t||Kre("Stroke bounding box must include transform.");const e=uae.singularValueDecompose2dScale(t),r=e[0]*this.lineWidth/2,a=e[1]*this.lineWidth/2;n[0]-=r,n[1]-=a,n[2]+=r,n[3]+=a}return n}updateClipFromPath(){const e=uae.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=voe,t=null){return uae.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function Toe(e,t){if(t instanceof ImageData)return void e.putImageData(t,0,0);const n=t.height,r=t.width,a=n%koe,o=(n-a)/koe,c=0===a?o:o+1,i=e.createImageData(r,koe);let l,s=0;const h=t.data,d=i.data;let u,m,p,v;if(t.kind===Bre.GRAYSCALE_1BPP){const t=h.byteLength,n=new Uint32Array(d.buffer,0,d.byteLength>>2),v=n.length,f=r+7>>3,z=4294967295,g=hae.isLittleEndian?4278190080:255;for(u=0;u<c;u++){for(p=u<o?koe:a,l=0,m=0;m<p;m++){const e=t-s;let a=0;const o=e>f?r:8*e-7,c=-8&o;let i=0,d=0;for(;a<c;a+=8)d=h[s++],n[l++]=128&d?z:g,n[l++]=64&d?z:g,n[l++]=32&d?z:g,n[l++]=16&d?z:g,n[l++]=8&d?z:g,n[l++]=4&d?z:g,n[l++]=2&d?z:g,n[l++]=1&d?z:g;for(;a<o;a++)0===i&&(d=h[s++],i=128),n[l++]=d&i?z:g,i>>=1}for(;l<v;)n[l++]=0;e.putImageData(i,0,u*koe)}}else if(t.kind===Bre.RGBA_32BPP){for(m=0,v=r*koe*4,u=0;u<o;u++)d.set(h.subarray(s,s+v)),s+=v,e.putImageData(i,0,m),m+=koe;u<c&&(v=r*a*4,d.set(h.subarray(s,s+v)),e.putImageData(i,0,m))}else{if(t.kind!==Bre.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(p=koe,v=r*p,u=0;u<c;u++){for(u>=o&&(p=a,v=r*p),l=0,m=v;m--;)d[l++]=h[s++],d[l++]=h[s++],d[l++]=h[s++],d[l++]=255;e.putImageData(i,0,u*koe)}}}function Ooe(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const n=t.height,r=t.width,a=n%koe,o=(n-a)/koe,c=0===a?o:o+1,i=e.createImageData(r,koe);let l=0;const s=t.data,h=i.data;for(let t=0;t<c;t++){const n=t<o?koe:a;({srcPos:l}=Loe({src:s,srcPos:l,dest:h,width:r,height:n,nonBlackColor:0})),e.putImageData(i,0,t*koe)}}function Aoe(e,t){const n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of n)void 0!==e[r]&&(t[r]=e[r]);void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function Roe(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0),!Are){const{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}}function Noe(e,t){if(t)return!0;const n=uae.singularValueDecompose2dScale(e);n[0]=Math.fround(n[0]),n[1]=Math.fround(n[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*gae.PDF_TO_CSS_UNITS);return n[0]<=r&&n[1]<=r}const _oe=["butt","round","square"],Doe=["miter","round","bevel"],Poe={},Foe={};class Ioe{constructor(e,t,n,r,a,{optionalContentConfig:o,markedContentStack:c=null},i,l){this.ctx=e,this.current=new xoe(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.filterFactory=a,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=c||[],this.optionalContentConfig=o,this.cachedCanvases=new woe(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=i,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:r=null}){const a=this.ctx.canvas.width,o=this.ctx.canvas.height,c=this.ctx.fillStyle;if(this.ctx.fillStyle=r||"#ffffff",this.ctx.fillRect(0,0,a,o),this.ctx.fillStyle=c,n){const e=this.cachedCanvases.getCanvas("transparent",a,o);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...Aae(this.compositeCtx))}this.ctx.save(),Roe(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=Aae(this.ctx)}executeOperatorList(e,t,n,r){const a=e.argsArray,o=e.fnArray;let c=t||0;const i=a.length;if(i===c)return c;const l=i-c>10&&"function"==typeof n,s=l?Date.now()+15:0;let h=0;const d=this.commonObjs,u=this.objs;let m;for(;;){if(void 0!==r&&c===r.nextBreakPoint)return r.breakIt(c,n),c;if(m=o[c],m!==Ure.dependency)this[m].apply(this,a[c]);else for(const e of a[c]){const t=e.startsWith("g_")?d:u;if(!t.has(e))return t.get(e,n),c}if(c++,c===i)return c;if(l&&++h>10){if(Date.now()>s)return n(),c;h=0}}}#sn(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#sn(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#hn()}#hn(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){const n=e.width??e.displayWidth,r=e.height??e.displayHeight;let a,o,c=Math.max(Math.hypot(t[0],t[1]),1),i=Math.max(Math.hypot(t[2],t[3]),1),l=n,s=r,h="prescale1";for(;c>2&&l>1||i>2&&s>1;){let t=l,n=s;c>2&&l>1&&(t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),c/=l/t),i>2&&s>1&&(n=s>=16384?Math.floor(s/2)-1||1:Math.ceil(s)/2,i/=s/n),a=this.cachedCanvases.getCanvas(h,t,n),o=a.context,o.clearRect(0,0,t,n),o.drawImage(e,0,0,l,s,0,0,t,n),e=a.canvas,l=t,s=n,h="prescale1"===h?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:s}}_createMaskCanvas(e){const t=this.ctx,{width:n,height:r}=e,a=this.current.fillColor,o=this.current.patternFill,c=Aae(t);let i,l,s,h;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;l=JSON.stringify(o?c:[c.slice(0,4),a]),i=this._cachedBitmapsMap.get(t),i||(i=new Map,this._cachedBitmapsMap.set(t,i));const n=i.get(l);if(n&&!o)return{canvas:n,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])};s=n}s||(h=this.cachedCanvases.getCanvas("maskCanvas",n,r),Ooe(h.context,e));let d=uae.transform(c,[1/n,0,0,-1/r,0,0]);d=uae.transform(d,[1,0,0,1,0,-r]);const[u,m,p,v]=uae.getAxialAlignedBoundingBox([0,0,n,r],d),f=Math.round(p-u)||1,z=Math.round(v-m)||1,g=this.cachedCanvases.getCanvas("fillCanvas",f,z),y=g.context,M=u,E=m;y.translate(-M,-E),y.transform(...d),s||(s=this._scaleImage(h.canvas,Rae(y)),s=s.img,i&&o&&i.set(l,s)),y.imageSmoothingEnabled=Noe(Aae(y),e.interpolate),Soe(y,s,0,0,s.width,s.height,0,0,n,r),y.globalCompositeOperation="source-in";const b=uae.transform(Rae(y),[1,0,0,1,-M,-E]);return y.fillStyle=o?a.getPattern(t,this,b,voe):a,y.fillRect(0,0,n,r),i&&!o&&(this.cachedCanvases.delete("fillCanvas"),i.set(l,g.canvas)),{canvas:g.canvas,offsetX:Math.round(M),offsetY:Math.round(E)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=_oe[e]}setLineJoin(e){this.ctx.lineJoin=Doe[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const n=this.ctx;void 0!==n.setLineDash&&(n.setLineDash(e),n.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,n]of e)switch(t){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx,this.ctx=r.context;const a=this.ctx;a.setTransform(...Aae(this.suspendedCtx)),Aoe(this.suspendedCtx,a),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},e.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},e.transform=function(e,n,r,a,o,c){t.transform(e,n,r,a,o,c),this.__originalTransform(e,n,r,a,o,c)},e.setTransform=function(e,n,r,a,o,c){t.setTransform(e,n,r,a,o,c),this.__originalSetTransform(e,n,r,a,o,c)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},e.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},e.bezierCurveTo=function(e,n,r,a,o,c){t.bezierCurveTo(e,n,r,a,o,c),this.__originalBezierCurveTo(e,n,r,a,o,c)},e.rect=function(e,n,r,a){t.rect(e,n,r,a),this.__originalRect(e,n,r,a)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(a,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Aoe(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,n,r){const a=r[0],o=r[1],c=r[2]-a,i=r[3]-o;0!==c&&0!==i&&(this.genericComposeSMask(t.context,n,c,i,t.subtype,t.backdrop,t.transferMap,a,o,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}genericComposeSMask(e,t,n,r,a,o,c,i,l,s,h){let d=e.canvas,u=i-s,m=l-h;if(o){const t=uae.makeHexColor(...o);if(u<0||m<0||u+n>d.width||m+r>d.height){const e=this.cachedCanvases.getCanvas("maskExtension",n,r),a=e.context;a.drawImage(d,-u,-m),a.globalCompositeOperation="destination-atop",a.fillStyle=t,a.fillRect(0,0,n,r),a.globalCompositeOperation="source-over",d=e.canvas,u=m=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const a=new Path2D;a.rect(u,m,n,r),e.clip(a),e.globalCompositeOperation="destination-atop",e.fillStyle=t,e.fillRect(u,m,n,r),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),"Alpha"===a&&c?t.filter=this.filterFactory.addAlphaFilter(c):"Luminosity"===a&&(t.filter=this.filterFactory.addLuminosityFilter(c));const p=new Path2D;p.rect(i,l,n,r),t.clip(p),t.globalCompositeOperation="destination-in",t.drawImage(d,u,m,n,r,i,l,n,r),t.restore()}save(){this.inSMaskMode?(Aoe(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Aoe(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,n,r,a,o){this.ctx.transform(e,t,n,r,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n){const r=this.ctx,a=this.current;let o,c,i=a.x,l=a.y;const s=Aae(r),h=0===s[0]&&0===s[3]||0===s[1]&&0===s[2],d=h?n.slice(0):null;for(let n=0,u=0,m=e.length;n<m;n++)switch(0|e[n]){case Ure.rectangle:i=t[u++],l=t[u++];const e=t[u++],n=t[u++],m=i+e,p=l+n;r.moveTo(i,l),0===e||0===n?r.lineTo(m,p):(r.lineTo(m,l),r.lineTo(m,p),r.lineTo(i,p)),h||a.updateRectMinMax(s,[i,l,m,p]),r.closePath();break;case Ure.moveTo:i=t[u++],l=t[u++],r.moveTo(i,l),h||a.updatePathMinMax(s,i,l);break;case Ure.lineTo:i=t[u++],l=t[u++],r.lineTo(i,l),h||a.updatePathMinMax(s,i,l);break;case Ure.curveTo:o=i,c=l,i=t[u+4],l=t[u+5],r.bezierCurveTo(t[u],t[u+1],t[u+2],t[u+3],i,l),a.updateCurvePathMinMax(s,o,c,t[u],t[u+1],t[u+2],t[u+3],i,l,d),u+=6;break;case Ure.curveTo2:o=i,c=l,r.bezierCurveTo(i,l,t[u],t[u+1],t[u+2],t[u+3]),a.updateCurvePathMinMax(s,o,c,i,l,t[u],t[u+1],t[u+2],t[u+3],d),i=t[u+2],l=t[u+3],u+=4;break;case Ure.curveTo3:o=i,c=l,i=t[u+2],l=t[u+3],r.bezierCurveTo(t[u],t[u+1],i,l,i,l),a.updateCurvePathMinMax(s,o,c,t[u],t[u+1],i,l,i,l,d),u+=4;break;case Ure.closePath:r.closePath()}h&&a.updateScalingPathMinMax(s,d),a.setCurrentPoint(i,l)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof n&&n?.getPattern?(t.save(),t.strokeStyle=n.getPattern(t,this,Rae(t),foe),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,n=this.current.fillColor;let r=!1;this.current.patternFill&&(t.save(),t.fillStyle=n.getPattern(t,this,Rae(t),voe),r=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),r&&t.restore(),e&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=Poe}eoClip(){this.pendingClip=Foe}beginText(){this.current.textMatrix=Rre,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0===e)return void t.beginPath();const n=new Path2D,r=t.getTransform().invertSelf();for(const{transform:t,x:a,y:o,fontSize:c,path:i}of e)n.addPath(i,new DOMMatrix(t).preMultiplySelf(r).translate(a,o).scale(c,-c));t.clip(n),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const n=this.commonObjs.get(e),r=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(r.fontMatrix=n.fontMatrix||Nre,0!==r.fontMatrix[0]&&0!==r.fontMatrix[3]||Yre("Invalid font matrix for font "+e),t<0?(t=-t,r.fontDirection=-1):r.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;const a=n.loadedName||"sans-serif",o=n.systemFontInfo?.css||`"${a}", ${n.fallbackName}`;let c="normal";n.black?c="900":n.bold&&(c="bold");const i=n.italic?"italic":"normal";let l=t;t<16?l=16:t>100&&(l=100),this.current.fontSizeScale=t/l,this.ctx.font=`${i} ${c} ${l}px ${o}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,n,r,a,o){this.current.textMatrix=[e,t,n,r,a,o],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}#dn(e,t,n){const r=new Path2D;return r.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),r}paintChar(e,t,n,r,a){const o=this.ctx,c=this.current,i=c.font,l=c.textRenderingMode,s=c.fontSize/c.fontSizeScale,h=3&l,d=!!(4&l),u=c.patternFill&&!i.missingFile,m=c.patternStroke&&!i.missingFile;let p;if((i.disableFontFace||d||u||m)&&(p=i.getPathGenerator(this.commonObjs,e)),i.disableFontFace||u||m){if(o.save(),o.translate(t,n),o.scale(s,-s),0===h||2===h)if(r){const e=o.getTransform();o.setTransform(...r),o.fill(this.#dn(p,e,r))}else o.fill(p);if(1===h||2===h)if(a){const e=o.getTransform();o.setTransform(...a),o.stroke(this.#dn(p,e,a))}else o.lineWidth/=s,o.stroke(p);o.restore()}else 0!==h&&2!==h||o.fillText(e,t,n),1!==h&&2!==h||o.strokeText(e,t,n);d&&(this.pendingTextPaths||=[]).push({transform:Aae(o),x:t,y:n,fontSize:s,path:p})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let n=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){n=!0;break}return Jre(this,"isFontSubpixelAAEnabled",n)}showText(e){const t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);const r=t.fontSize;if(0===r)return;const a=this.ctx,o=t.fontSizeScale,c=t.charSpacing,i=t.wordSpacing,l=t.fontDirection,s=t.textHScale*l,h=e.length,d=n.vertical,u=d?1:-1,m=n.defaultVMetrics,p=r*t.fontMatrix[0],v=0===t.textRenderingMode&&!n.disableFontFace&&!t.patternFill;let f,z;if(a.save(),a.transform(...t.textMatrix),a.translate(t.x,t.y+t.textRise),l>0?a.scale(s,-1):a.scale(s,1),t.patternFill){a.save();const e=t.fillColor.getPattern(a,this,Rae(a),voe);f=Aae(a),a.restore(),a.fillStyle=e}if(t.patternStroke){a.save();const e=t.strokeColor.getPattern(a,this,Rae(a),foe);z=Aae(a),a.restore(),a.strokeStyle=e}let g=t.lineWidth;const y=t.textMatrixScale;if(0===y||0===g){const e=3&t.textRenderingMode;1!==e&&2!==e||(g=this.getSinglePixelWidth())}else g/=y;if(1!==o&&(a.scale(o,o),g/=o),a.lineWidth=g,n.isInvalidPDFjsFont){const n=[];let r=0;for(const t of e)n.push(t.unicode),r+=t.width;return a.fillText(n.join(""),0,0),t.x+=r*p*s,a.restore(),void this.compose()}let M,E=0;for(M=0;M<h;++M){const t=e[M];if("number"==typeof t){E+=u*t*r/1e3;continue}let s=!1;const h=(t.isSpace?i:0)+c,g=t.fontChar,y=t.accent;let b,H,V=t.width;if(d){const e=t.vmetric||m,n=-(t.vmetric?e[1]:.5*V)*p,r=e[2]*p;V=e?-e[0]:V,b=n/o,H=(E+r)/o}else b=E/o,H=0;if(n.remeasure&&V>0){const e=1e3*a.measureText(g).width/r*o;if(V<e&&this.isFontSubpixelAAEnabled){const t=V/e;s=!0,a.save(),a.scale(t,1),b/=t}else V!==e&&(b+=(V-e)/2e3*r/o)}if(this.contentVisible&&(t.isInFont||n.missingFile))if(v&&!y)a.fillText(g,b,H);else if(this.paintChar(g,b,H,f,z),y){const e=b+r*y.offset.x/o,t=H-r*y.offset.y/o;this.paintChar(y.fontChar,e,t,f,z)}E+=d?V*p-h*l:V*p+h*l,s&&a.restore()}d?t.y-=E:t.x+=E*s,a.restore(),this.compose()}showType3Text(e){const t=this.ctx,n=this.current,r=n.font,a=n.fontSize,o=n.fontDirection,c=r.vertical?1:-1,i=n.charSpacing,l=n.wordSpacing,s=n.textHScale*o,h=n.fontMatrix||Nre,d=e.length;let u,m,p,v;if(3!==n.textRenderingMode&&0!==a){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...n.textMatrix),t.translate(n.x,n.y),t.scale(s,o),u=0;u<d;++u){if(m=e[u],"number"==typeof m){v=c*m*a/1e3,this.ctx.translate(v,0),n.x+=v*s;continue}const o=(m.isSpace?l:0)+i,d=r.charProcOperatorList[m.operatorListId];d?(this.contentVisible&&(this.processingType3=m,this.save(),t.scale(a,a),t.transform(...h),this.executeOperatorList(d),this.restore()),p=uae.applyTransform([m.width,0],h)[0]*a+o,t.translate(p,0),n.x+=p*s):Yre(`Type3 character "${m.operatorListId}" is not available.`)}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,n,r,a,o){this.ctx.rect(n,r,a-n,o-r),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const n=e[1],r=this.baseTransform||Aae(this.ctx),a={createCanvasGraphics:e=>new Ioe(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new Coe(e,n,this.ctx,a,r)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,n){this.ctx.strokeStyle=this.current.strokeColor=uae.makeHexColor(e,t,n),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t,n){this.ctx.fillStyle=this.current.fillColor=uae.makeHexColor(e,t,n),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=function(e){switch(e[0]){case"RadialAxial":return new Moe(e);case"Mesh":return new Hoe(e);case"Dummy":return new Voe}throw new Error(`Unknown IR type: ${e[0]}`)}(this.getObject(e)),this.cachedPatterns.set(e,n)),t&&(n.matrix=t),n}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const n=this._getPattern(e);t.fillStyle=n.getPattern(t,this,Rae(t),zoe);const r=Rae(t);if(r){const{width:e,height:n}=t.canvas,[a,o,c,i]=uae.getAxialAlignedBoundingBox([0,0,e,n],r);this.ctx.fillRect(a,o,c-a,i-o)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Kre("Should not call beginInlineImage")}beginImageData(){Kre("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=Aae(this.ctx),t)){const e=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],e,n),this.current.updateRectMinMax(Aae(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||Gre("TODO: Support non-isolated groups."),e.knockout&&Yre("Knockout groups not supported.");const n=Aae(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=uae.getAxialAlignedBoundingBox(e.bbox,Aae(t));const a=[0,0,t.canvas.width,t.canvas.height];r=uae.intersect(r,a)||[0,0,0,0];const o=Math.floor(r[0]),c=Math.floor(r[1]),i=Math.max(Math.ceil(r[2])-o,1),l=Math.max(Math.ceil(r[3])-c,1);this.current.startNewPathAndClipBox([0,0,i,l]);let s="groupAt"+this.groupLevel;e.smask&&(s+="_smask_"+this.smaskCounter++%2);const h=this.cachedCanvases.getCanvas(s,i,l),d=h.context;d.translate(-o,-c),d.transform(...n),e.smask?this.smaskStack.push({canvas:h.canvas,context:d,offsetX:o,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,c),t.save()),Aoe(t,d),this.ctx=d,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=Aae(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const n=uae.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,t,n,r,a){if(this.#sn(),Roe(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const r=t[2]-t[0],o=t[3]-t[1];if(a&&this.annotationCanvasMap){(n=n.slice())[4]-=t[0],n[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=r,t[3]=o;const[a,c]=uae.singularValueDecompose2dScale(Aae(this.ctx)),{viewportScale:i}=this,l=Math.ceil(r*this.outputScaleX*i),s=Math.ceil(o*this.outputScaleY*i);this.annotationCanvas=this.canvasFactory.create(l,s);const{canvas:h,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(e,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.save(),this.ctx.setTransform(a,0,0,-c,0,o*c),Roe(this.ctx)}else Roe(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],r,o),this.ctx.clip(),this.ctx.beginPath()}this.current=new xoe(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...r)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#hn(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const n=this.ctx,r=this.processingType3;if(r&&(void 0===r.compiled&&(r.compiled=function(e){const{width:t,height:n}=e;if(t>1e3||n>1e3)return null;const r=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),a=t+1;let o,c,i,l=new Uint8Array(a*(n+1));const s=t+7&-8;let h=new Uint8Array(s*n),d=0;for(const t of e.data){let e=128;for(;e>0;)h[d++]=t&e?0:255,e>>=1}let u=0;for(d=0,0!==h[d]&&(l[0]=1,++u),c=1;c<t;c++)h[d]!==h[d+1]&&(l[c]=h[d]?2:1,++u),d++;for(0!==h[d]&&(l[c]=2,++u),o=1;o<n;o++){d=o*s,i=o*a,h[d-s]!==h[d]&&(l[i]=h[d]?1:8,++u);let e=(h[d]?4:0)+(h[d-s]?8:0);for(c=1;c<t;c++)e=(e>>2)+(h[d+1]?4:0)+(h[d-s+1]?8:0),r[e]&&(l[i+c]=r[e],++u),d++;if(h[d-s]!==h[d]&&(l[i+c]=h[d]?2:4,++u),u>1e3)return null}for(d=s*(n-1),i=o*a,0!==h[d]&&(l[i]=8,++u),c=1;c<t;c++)h[d]!==h[d+1]&&(l[i+c]=h[d]?4:8,++u),d++;if(0!==h[d]&&(l[i+c]=4,++u),u>1e3)return null;const m=new Int32Array([0,a,-1,0,-a,0,0,0,1]),p=new Path2D;for(o=0;u&&o<=n;o++){let e=o*a;const n=e+t;for(;e<n&&!l[e];)e++;if(e===n)continue;p.moveTo(e%a,o);const r=e;let c=l[e];do{const t=m[c];do{e+=t}while(!l[e]);const n=l[e];5!==n&&10!==n?(c=n,l[e]=0):(c=n&51*c>>4,l[e]&=c>>2|c<<2),p.lineTo(e%a,e/a|0),l[e]||--u}while(r!==e);--o}return h=null,l=null,function(e){e.save(),e.scale(1/t,-1/n),e.translate(0,-n),e.fill(p),e.beginPath(),e.restore()}}(e)),r.compiled))return void r.compiled(n);const a=this._createMaskCanvas(e),o=a.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(o,a.offsetX,a.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n=0,r=0,a,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const c=this.ctx;c.save();const i=Aae(c);c.transform(t,n,r,a,0,0);const l=this._createMaskCanvas(e);c.setTransform(1,0,0,1,l.offsetX-i[4],l.offsetY-i[5]);for(let e=0,s=o.length;e<s;e+=2){const s=uae.transform(i,[t,n,r,a,o[e],o[e+1]]),[h,d]=uae.applyTransform([0,0],s);c.drawImage(l.canvas,h,d)}c.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,n=this.current.fillColor,r=this.current.patternFill;for(const a of e){const{data:e,width:o,height:c,transform:i}=a,l=this.cachedCanvases.getCanvas("maskCanvas",o,c),s=l.context;s.save(),Ooe(s,this.getObject(e,a)),s.globalCompositeOperation="source-in",s.fillStyle=r?n.getPattern(s,this,Rae(t),voe):n,s.fillRect(0,0,o,c),s.restore(),t.save(),t.transform(...i),t.scale(1,-1),Soe(t,l.canvas,0,0,o,c,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):Yre("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,n,r){if(!this.contentVisible)return;const a=this.getObject(e);if(!a)return void Yre("Dependent image isn't ready yet");const o=a.width,c=a.height,i=[];for(let e=0,a=r.length;e<a;e+=2)i.push({transform:[t,0,0,n,r[e],r[e+1]],x:0,y:0,w:o,h:c});this.paintInlineImageXObjectGroup(a,i)}applyTransferMapsToCanvas(e){return"none"!==this.current.transferMaps&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:n,height:r}=e,a=this.cachedCanvases.getCanvas("inlineImage",n,r),o=a.context;return o.filter=this.current.transferMaps,o.drawImage(t,0,0),o.filter="none",a.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,n=e.height,r=this.ctx;if(this.save(),!Are){const{filter:e}=r;"none"!==e&&""!==e&&(r.filter="none")}let a;if(r.scale(1/t,-1/n),e.bitmap)a=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)a=e;else{const r=this.cachedCanvases.getCanvas("inlineImage",t,n).context;Toe(r,e),a=this.applyTransferMapsToCanvas(r)}const o=this._scaleImage(a,Rae(r));r.imageSmoothingEnabled=Noe(Aae(r),e.interpolate),Soe(r,o.img,0,0,o.paintWidth,o.paintHeight,0,-n,t,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const n=this.ctx;let r;if(e.bitmap)r=e.bitmap;else{const t=e.width,n=e.height,a=this.cachedCanvases.getCanvas("inlineImage",t,n).context;Toe(a,e),r=this.applyTransferMapsToCanvas(a)}for(const e of t)n.save(),n.transform(...e.transform),n.scale(1,-1),Soe(n,r,e.x,e.y,e.w,e.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const n=this.ctx;this.pendingClip&&(t||(this.pendingClip===Foe?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Aae(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:n,c:r,d:a}=this.ctx.getTransform();let o,c;if(0===n&&0===r){const n=Math.abs(t),r=Math.abs(a);if(n===r)if(0===e)o=c=1/n;else{const t=n*e;o=c=t<1?1/t:1}else if(0===e)o=1/n,c=1/r;else{const t=n*e,a=r*e;o=t<1?1/t:1,c=a<1?1/a:1}}else{const i=Math.abs(t*a-n*r),l=Math.hypot(t,n),s=Math.hypot(r,a);if(0===e)o=s/i,c=l/i;else{const t=e*i;o=s>t?s/t:1,c=l>t?l/t:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=c}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:n}=this.current,[r,a]=this.getScaleForStroking();if(t.lineWidth=n||1,1===r&&1===a)return void t.stroke();const o=t.getLineDash();if(e&&t.save(),t.scale(r,a),o.length>0){const e=Math.max(r,a);t.setLineDash(o.map((t=>t/e))),t.lineDashOffset/=e}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const e in Ure)void 0!==Ioe.prototype[e]&&(Ioe.prototype[Ure[e]]=Ioe.prototype[e]);class Boe{static#un=null;static#mn="";static get workerPort(){return this.#un}static set workerPort(e){if(!("undefined"!=typeof Worker&&e instanceof Worker)&&null!==e)throw new Error("Invalid `workerPort` type.");this.#un=e}static get workerSrc(){return this.#mn}static set workerSrc(e){if("string"!=typeof e)throw new Error("Invalid `workerSrc` type.");this.#mn=e}}class joe{#pn;#vn;constructor({parsedData:e,rawData:t}){this.#pn=e,this.#vn=t}getRaw(){return this.#vn}get(e){return this.#pn.get(e)??null}getAll(){return sae(this.#pn)}has(e){return this.#pn.has(e)}}const Uoe=Symbol("INTERNAL");class Woe{#fn=!1;#zn=!1;#gn=!1;#yn=!0;constructor(e,{name:t,intent:n,usage:r,rbGroups:a}){this.#fn=!!(2&e),this.#zn=!!(4&e),this.name=t,this.intent=n,this.usage=r,this.rbGroups=a}get visible(){if(this.#gn)return this.#yn;if(!this.#yn)return!1;const{print:e,view:t}=this.usage;return this.#fn?"OFF"!==t?.viewState:!this.#zn||"OFF"!==e?.printState}_setVisible(e,t,n=!1){e!==Uoe&&Kre("Internal method `_setVisible` called."),this.#gn=n,this.#yn=t}}class $oe{#Mn=null;#En=new Map;#bn=null;#Hn=null;constructor(e,t=2){if(this.renderingIntent=t,this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#Hn=e.order;for(const n of e.groups)this.#En.set(n.id,new Woe(t,n));if("OFF"===e.baseState)for(const e of this.#En.values())e._setVisible(Uoe,!1);for(const t of e.on)this.#En.get(t)._setVisible(Uoe,!0);for(const t of e.off)this.#En.get(t)._setVisible(Uoe,!1);this.#bn=this.getHash()}}#Vn(e){const t=e.length;if(t<2)return!0;const n=e[0];for(let r=1;r<t;r++){const t=e[r];let a;if(Array.isArray(t))a=this.#Vn(t);else{if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;a=this.#En.get(t).visible}switch(n){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return"And"===n}isVisible(e){if(0===this.#En.size)return!0;if(!e)return Gre("Optional content group not defined."),!0;if("OCG"===e.type)return this.#En.has(e.id)?this.#En.get(e.id).visible:(Yre(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#Vn(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;if(this.#En.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;if(!this.#En.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;if(!this.#En.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;if(this.#En.get(t).visible)return!1}return!0}return Yre(`Unknown optional content policy ${e.policy}.`),!0}return Yre(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){const r=this.#En.get(e);if(r){if(n&&t&&r.rbGroups.length)for(const t of r.rbGroups)for(const n of t)n!==e&&this.#En.get(n)?._setVisible(Uoe,!1,!0);r._setVisible(Uoe,!!t,!0),this.#Mn=null}else Yre(`Optional content group not found: ${e}`)}setOCGState({state:e,preserveRB:t}){let n;for(const r of e){switch(r){case"ON":case"OFF":case"Toggle":n=r;continue}const e=this.#En.get(r);if(e)switch(n){case"ON":this.setVisibility(r,!0,t);break;case"OFF":this.setVisibility(r,!1,t);break;case"Toggle":this.setVisibility(r,!e.visible,t)}}this.#Mn=null}get hasInitialVisibility(){return null===this.#bn||this.getHash()===this.#bn}getOrder(){return this.#En.size?this.#Hn?this.#Hn.slice():[...this.#En.keys()]:null}getGroups(){return this.#En.size>0?sae(this.#En):null}getGroup(e){return this.#En.get(e)||null}getHash(){if(null!==this.#Mn)return this.#Mn;const e=new Zae;for(const[t,n]of this.#En)e.update(`${t}:${n.visible}`);return this.#Mn=e.hexdigest()}}class qoe{constructor(e,{disableRange:t=!1,disableStream:n=!1}){Xre(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:r,initialData:a,progressiveDone:o,contentDispositionFilename:c}=e;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=c,a?.length>0){const e=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!t,this._contentLength=r,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),e.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),e.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),e.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const n=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;void 0===e?this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n):Xre(this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(n),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){Xre(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new Goe(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new Yoe(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}class Goe{constructor(e,t,n=!1,r=null){this._stream=e,this._done=n||!1,this._filename=Hae(r)?r:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Yoe{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Koe(e,t){const n=new Headers;if(!e||!t||"object"!=typeof t)return n;for(const e in t){const r=t[e];void 0!==r&&n.append(e,r)}return n}function Xoe(e){try{return new URL(e).origin}catch{}return null}function Qoe({responseHeaders:e,isHttp:t,rangeChunkSize:n,disableRange:r}){const a={allowRangeRequests:!1,suggestedLength:void 0},o=parseInt(e.get("Content-Length"),10);return Number.isInteger(o)?(a.suggestedLength=o,o<=2*n||r||!t||"bytes"!==e.get("Accept-Ranges")||"identity"!==(e.get("Content-Encoding")||"identity")||(a.allowRangeRequests=!0),a):a}function Joe(e){const t=e.get("Content-Disposition");if(t){let e=function(e){let t=!0,n=r("filename\\*","i").exec(e);if(n){n=n[1];let e=c(n);return e=unescape(e),e=i(e),e=l(e),o(e)}if(n=function(e){const t=[];let n;const a=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(n=a.exec(e));){let[,e,r,a]=n;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[r,a]}const o=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=c(r),n&&(r=unescape(r),0===e&&(r=i(r))),o.push(r)}return o.join("")}(e),n)return o(l(n));if(n=r("filename","i").exec(e),n){n=n[1];let e=c(n);return e=l(e),o(e)}function r(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function a(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{const r=new TextDecoder(e,{fatal:!0}),a=lae(n);n=r.decode(a),t=!1}catch{}}return n}function o(e){return t&&/[\x80-\xff]/.test(e)&&(e=a("utf-8",e),t&&(e=a("iso-8859-1",e))),e}function c(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const n=t[e].indexOf('"');-1!==n&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,"$1")}e=t.join('"')}return e}function i(e){const t=e.indexOf("'");return-1===t?e:a(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function l(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,n,r){if("q"===n||"Q"===n)return a(t,r=(r=r.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})));try{r=atob(r)}catch{}return a(t,r)}))}return""}(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Hae(e))return e}return null}function Zoe(e,t){return 404===e||0===e&&t.startsWith("file:")?new rae('Missing PDF "'+t+'".'):new aae(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function ece(e){return 200===e||206===e}function tce(e,t,n){return{method:"GET",headers:e,signal:n.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function nce(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(Yre(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class rce{_responseOrigin=null;constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Koe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Xre(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new ace(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new oce(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class ace{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const n=new Headers(e.headers),r=t.url;fetch(r,tce(n,this._withCredentials,this._abortController)).then((t=>{if(e._responseOrigin=Xoe(t.url),!ece(t.status))throw Zoe(t.status,r);this._reader=t.body.getReader(),this._headersCapability.resolve();const n=t.headers,{allowRangeRequests:a,suggestedLength:o}=Qoe({responseHeaders:n,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=Joe(n),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new cae("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:nce(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class oce{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;const r=e.source;this._withCredentials=r.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!r.disableStream,this._abortController=new AbortController;const a=new Headers(e.headers);a.append("Range",`bytes=${t}-${n-1}`);const o=r.url;fetch(o,tce(a,this._withCredentials,this._abortController)).then((t=>{const n=Xoe(t.url);if(n!==e._responseOrigin)throw new Error(`Expected range response-origin "${n}" to match "${e._responseOrigin}".`);if(!ece(t.status))throw Zoe(t.status,o);this._readCapability.resolve(),this._reader=t.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:nce(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class cce{_responseOrigin=null;constructor({url:e,httpHeaders:t,withCredentials:n}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Koe(this.isHttp,t),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const t=new XMLHttpRequest,n=this.currXhrId++,r=this.pendingRequests[n]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[e,n]of this.headers)t.setRequestHeader(e,n);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),r.expectedStatus=206):r.expectedStatus=200,t.responseType="arraybuffer",Xre(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{e.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){const n=this.pendingRequests[e];n&&n.onProgress?.(t)}onStateChange(e,t){const n=this.pendingRequests[e];if(!n)return;const r=n.xhr;if(r.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4!==r.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===r.status&&this.isHttp)return void n.onError(r.status);const a=r.status||200;if((200!==a||206!==n.expectedStatus)&&a!==n.expectedStatus)return void n.onError(r.status);const o=function(e){const t=e.response;return"string"!=typeof t?t:lae(t).buffer}(r);if(206===a){const e=r.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);t?n.onDone({begin:parseInt(t[1],10),chunk:o}):(Yre('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone({begin:0,chunk:o}):n.onError(r.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class ice{constructor(e){this._source=e,this._manager=new cce(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return Xre(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new lce(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const n=new sce(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class lce{constructor(e,t){this._manager=e,this._url=t.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=Xoe(t.responseURL);const n=t.getAllResponseHeaders(),r=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map((e=>{const[t,...n]=e.split(": ");return[t,n.join(": ")]})):[]),{allowRangeRequests:a,suggestedLength:o}=Qoe({responseHeaders:r,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=Joe(r),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Zoe(e,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class sce{constructor(e,t,n){this._manager=e,this._url=e.url,this._requestId=e.request({begin:t,end:n,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){const e=Xoe(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??=Zoe(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const hce=/^[a-z][a-z0-9\-+.]+:/i;class dce{constructor(e){this.source=e,this.url=function(e){if(hce.test(e))return new URL(e);const t=St.getBuiltinModule("url");return new URL(t.pathToFileURL(e))}(e.url),Xre("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Xre(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new uce(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new mce(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class uce{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const n=St.getBuiltinModule("fs");n.promises.lstat(this._url).then((e=>{this._contentLength=e.size,this._setReadableStream(n.createReadStream(this._url)),this._headersCapability.resolve()}),(e=>{"ENOENT"===e.code&&(e=new rae(`Missing PDF "${this._url}".`)),this._storedError=e,this._headersCapability.reject(e)}))}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new cae("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class mce{constructor(e,t,n){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const r=e.source;this._isStreamingSupported=!r.disableStream;const a=St.getBuiltinModule("fs");this._setReadableStream(a.createReadStream(this._url,{start:t,end:n-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}const pce=30;class vce{#Cn=Promise.withResolvers();#me=null;#Ln=!1;#kn=!!globalThis.FontInspector?.enabled;#wn=null;#Sn=null;#xn=0;#Tn=0;#On=null;#An=null;#Rn=0;#Nn=0;#_n=Object.create(null);#Dn=[];#Pn=null;#Fn=[];#In=new WeakMap;#Bn=null;static#jn=new Map;static#Un=new Map;static#Wn=new WeakMap;static#$n=null;static#qn=new Set;constructor({textContentSource:e,container:t,viewport:n}){if(e instanceof ReadableStream)this.#Pn=e;else{if("object"!=typeof e)throw new Error('No "textContentSource" parameter specified.');this.#Pn=new ReadableStream({start(t){t.enqueue(e),t.close()}})}this.#me=this.#An=t,this.#Nn=n.scale*(globalThis.devicePixelRatio||1),this.#Rn=n.rotation,this.#Sn={div:null,properties:null,ctx:null};const{pageWidth:r,pageHeight:a,pageX:o,pageY:c}=n.rawDims;this.#Bn=[1,0,0,-1,-o,c+a],this.#Tn=r,this.#xn=a,vce.#Gn(),Nae(t,n),this.#Cn.promise.finally((()=>{vce.#qn.delete(this),this.#Sn=null,this.#_n=null})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=hae.platform;return Jre(this,"fontFamilyMap",new Map([["sans-serif",(e&&t?"Calibri, ":"")+"sans-serif"],["monospace",(e&&t?"Lucida Console, ":"")+"monospace"]]))}render(){const e=()=>{this.#On.read().then((({value:t,done:n})=>{n?this.#Cn.resolve():(this.#wn??=t.lang,Object.assign(this.#_n,t.styles),this.#Yn(t.items),e())}),this.#Cn.reject)};return this.#On=this.#Pn.getReader(),vce.#qn.add(this),e(),this.#Cn.promise}update({viewport:e,onBefore:t=null}){const n=e.scale*(globalThis.devicePixelRatio||1),r=e.rotation;if(r!==this.#Rn&&(t?.(),this.#Rn=r,Nae(this.#An,{rotation:r})),n!==this.#Nn){t?.(),this.#Nn=n;const e={div:null,properties:null,ctx:vce.#Kn(this.#wn)};for(const t of this.#Fn)e.properties=this.#In.get(t),e.div=t,this.#Xn(e)}}cancel(){const e=new cae("TextLayer task cancelled.");this.#On?.cancel(e).catch((()=>{})),this.#On=null,this.#Cn.reject(e)}get textDivs(){return this.#Fn}get textContentItemsStr(){return this.#Dn}#Yn(e){if(this.#Ln)return;this.#Sn.ctx??=vce.#Kn(this.#wn);const t=this.#Fn,n=this.#Dn;for(const r of e){if(t.length>1e5)return Yre("Ignoring additional textDivs for performance reasons."),void(this.#Ln=!0);if(void 0!==r.str)n.push(r.str),this.#Qn(r);else if("beginMarkedContentProps"===r.type||"beginMarkedContent"===r.type){const e=this.#me;this.#me=document.createElement("span"),this.#me.classList.add("markedContent"),null!==r.id&&this.#me.setAttribute("id",`${r.id}`),e.append(this.#me)}else"endMarkedContent"===r.type&&(this.#me=this.#me.parentNode)}}#Qn(e){const t=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};this.#Fn.push(t);const r=uae.transform(this.#Bn,e.transform);let a=Math.atan2(r[1],r[0]);const o=this.#_n[e.fontName];o.vertical&&(a+=Math.PI/2);let c=this.#kn&&o.fontSubstitution||o.fontFamily;c=vce.fontFamilyMap.get(c)||c;const i=Math.hypot(r[2],r[3]),l=i*vce.#Jn(c,this.#wn);let s,h;0===a?(s=r[4],h=r[5]-l):(s=r[4]+l*Math.sin(a),h=r[5]-l*Math.cos(a));const d="calc(var(--scale-factor)*",u=t.style;this.#me===this.#An?(u.left=`${(100*s/this.#Tn).toFixed(2)}%`,u.top=`${(100*h/this.#xn).toFixed(2)}%`):(u.left=`${d}${s.toFixed(2)}px)`,u.top=`${d}${h.toFixed(2)}px)`),u.fontSize=`${d}${(vce.#$n*i).toFixed(2)}px)`,u.fontFamily=c,n.fontSize=i,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,this.#kn&&(t.dataset.fontName=o.fontSubstitutionLoadedName||e.fontName),0!==a&&(n.angle=a*(180/Math.PI));let m=!1;if(e.str.length>1)m=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),n=Math.abs(e.transform[3]);t!==n&&Math.max(t,n)/Math.min(t,n)>1.5&&(m=!0)}if(m&&(n.canvasWidth=o.vertical?e.height:e.width),this.#In.set(t,n),this.#Sn.div=t,this.#Sn.properties=n,this.#Xn(this.#Sn),n.hasText&&this.#me.append(t),n.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this.#me.append(e)}}#Xn(e){const{div:t,properties:n,ctx:r}=e,{style:a}=t;let o="";if(vce.#$n>1&&(o=`scale(${1/vce.#$n})`),0!==n.canvasWidth&&n.hasText){const{fontFamily:e}=a,{canvasWidth:c,fontSize:i}=n;vce.#Zn(r,i*this.#Nn,e);const{width:l}=r.measureText(t.textContent);l>0&&(o=`scaleX(${c*this.#Nn/l}) ${o}`)}0!==n.angle&&(o=`rotate(${n.angle}deg) ${o}`),o.length>0&&(a.transform=o)}static cleanup(){if(!(this.#qn.size>0)){this.#jn.clear();for(const{canvas:e}of this.#Un.values())e.remove();this.#Un.clear()}}static#Kn(e=null){let t=this.#Un.get(e||="");if(!t){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),t=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#Un.set(e,t),this.#Wn.set(t,{size:0,family:""})}return t}static#Zn(e,t,n){const r=this.#Wn.get(e);t===r.size&&n===r.family||(e.font=`${t}px ${n}`,r.size=t,r.family=n)}static#Gn(){if(null!==this.#$n)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#$n=e.getBoundingClientRect().height,e.remove()}static#Jn(e,t){const n=this.#jn.get(e);if(n)return n;const r=this.#Kn(t);r.canvas.width=r.canvas.height=pce,this.#Zn(r,pce,e);const a=r.measureText("");let o=a.fontBoundingBoxAscent,c=Math.abs(a.fontBoundingBoxDescent);if(o){const t=o/(o+c);return this.#jn.set(e,t),r.canvas.width=r.canvas.height=0,t}r.strokeStyle="red",r.clearRect(0,0,pce,pce),r.strokeText("g",0,0);let i=r.getImageData(0,0,pce,pce).data;c=0;for(let e=i.length-1-3;e>=0;e-=4)if(i[e]>0){c=Math.ceil(e/4/pce);break}r.clearRect(0,0,pce,pce),r.strokeText("A",0,pce),i=r.getImageData(0,0,pce,pce).data,o=0;for(let e=0,t=i.length;e<t;e+=4)if(i[e]>0){o=pce-Math.floor(e/4/pce);break}r.canvas.width=r.canvas.height=0;const l=o?o/(o+c):.8;return this.#jn.set(e,l),l}}class fce{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};return function e(n){if(!n)return;let r=null;const a=n.name;if("#text"===a)r=n.value;else{if(!fce.shouldBuildText(a))return;n?.attributes?.textContent?r=n.attributes.textContent:n.value&&(r=n.value)}if(null!==r&&t.push({str:r}),n.children)for(const t of n.children)e(t)}(e),n}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}const zce=65536,gce=Are?class extends loe{_createCanvas(e,t){return St.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}:class extends loe{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const n=this._document.createElement("canvas");return n.width=e,n.height=t,n}},yce=Are?class extends soe{async _fetch(e){return poe(e)}}:hoe,Mce=Are?class extends doe{}:class extends doe{#er;#tr;#nr;#rr;#ar;#or;#y=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#rr=e,this.#ar=t}get#E(){return this.#tr||=new Map}get#cr(){return this.#or||=new Map}get#ir(){if(!this.#nr){const e=this.#ar.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;const n=this.#ar.createElementNS(zae,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#nr=this.#ar.createElementNS(zae,"defs"),e.append(n),n.append(this.#nr),this.#ar.body.append(e)}return this.#nr}#lr(e){if(1===e.length){const t=e[0],n=new Array(256);for(let e=0;e<256;e++)n[e]=t[e]/255;const r=n.join(",");return[r,r,r]}const[t,n,r]=e,a=new Array(256),o=new Array(256),c=new Array(256);for(let e=0;e<256;e++)a[e]=t[e]/255,o[e]=n[e]/255,c[e]=r[e]/255;return[a.join(","),o.join(","),c.join(",")]}#sr(e){if(void 0===this.#er){this.#er="";const e=this.#ar.URL;e!==this.#ar.baseURI&&(bae(e)?Yre('#createUrl: ignore "data:"-URL for performance reasons.'):this.#er=e.split("#",1)[0])}return`url(${this.#er}#${e})`}addFilter(e){if(!e)return"none";let t=this.#E.get(e);if(t)return t;const[n,r,a]=this.#lr(e),o=1===e.length?n:`${n}${r}${a}`;if(t=this.#E.get(o),t)return this.#E.set(e,t),t;const c=`g_${this.#rr}_transfer_map_${this.#y++}`,i=this.#sr(c);this.#E.set(e,i),this.#E.set(o,i);const l=this.#hr(c);return this.#dr(n,r,a,l),i}addHCMFilter(e,t){const n=`${e}-${t}`,r="base";let a=this.#cr.get(r);if(a?.key===n)return a.url;if(a?(a.filter?.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},this.#cr.set(r,a)),!e||!t)return a.url;const o=this.#ur(e);e=uae.makeHexColor(...o);const c=this.#ur(t);if(t=uae.makeHexColor(...c),this.#ir.style.color="","#000000"===e&&"#ffffff"===t||e===t)return a.url;const i=new Array(256);for(let e=0;e<=255;e++){const t=e/255;i[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=i.join(","),s=`g_${this.#rr}_hcm_filter`,h=a.filter=this.#hr(s);this.#dr(l,l,l,h),this.#mr(h);const d=(e,t)=>{const n=o[e]/255,r=c[e]/255,a=new Array(t+1);for(let e=0;e<=t;e++)a[e]=n+e/t*(r-n);return a.join(",")};return this.#dr(d(0,5),d(1,5),d(2,5),h),a.url=this.#sr(s),a.url}addAlphaFilter(e){let t=this.#E.get(e);if(t)return t;const[n]=this.#lr([e]),r=`alpha_${n}`;if(t=this.#E.get(r),t)return this.#E.set(e,t),t;const a=`g_${this.#rr}_alpha_map_${this.#y++}`,o=this.#sr(a);this.#E.set(e,o),this.#E.set(r,o);const c=this.#hr(a);return this.#pr(n,c),o}addLuminosityFilter(e){let t,n,r=this.#E.get(e||"luminosity");if(r)return r;if(e?([t]=this.#lr([e]),n=`luminosity_${t}`):n="luminosity",r=this.#E.get(n),r)return this.#E.set(e,r),r;const a=`g_${this.#rr}_luminosity_map_${this.#y++}`,o=this.#sr(a);this.#E.set(e,o),this.#E.set(n,o);const c=this.#hr(a);return this.#vr(c),e&&this.#pr(t,c),o}addHighlightHCMFilter(e,t,n,r,a){const o=`${t}-${n}-${r}-${a}`;let c=this.#cr.get(e);if(c?.key===o)return c.url;if(c?(c.filter?.remove(),c.key=o,c.url="none",c.filter=null):(c={key:o,url:"none",filter:null},this.#cr.set(e,c)),!t||!n)return c.url;const[i,l]=[t,n].map(this.#ur.bind(this));let s=Math.round(.2126*i[0]+.7152*i[1]+.0722*i[2]),h=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[d,u]=[r,a].map(this.#ur.bind(this));h<s&&([s,h,d,u]=[h,s,u,d]),this.#ir.style.color="";const m=(e,t,n)=>{const r=new Array(256),a=(h-s)/n,o=e/255,c=(t-e)/(255*n);let i=0;for(let e=0;e<=n;e++){const t=Math.round(s+e*a),n=o+e*c;for(let e=i;e<=t;e++)r[e]=n;i=t+1}for(let e=i;e<256;e++)r[e]=r[i-1];return r.join(",")},p=`g_${this.#rr}_hcm_${e}_filter`,v=c.filter=this.#hr(p);return this.#mr(v),this.#dr(m(d[0],u[0],5),m(d[1],u[1],5),m(d[2],u[2],5),v),c.url=this.#sr(p),c.url}destroy(e=!1){e&&this.#or?.size||(this.#nr?.parentNode.parentNode.remove(),this.#nr=null,this.#tr?.clear(),this.#tr=null,this.#or?.clear(),this.#or=null,this.#y=0)}#vr(e){const t=this.#ar.createElementNS(zae,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(t)}#mr(e){const t=this.#ar.createElementNS(zae,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(t)}#hr(e){const t=this.#ar.createElementNS(zae,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#ir.append(t),t}#fr(e,t,n){const r=this.#ar.createElementNS(zae,t);r.setAttribute("type","discrete"),r.setAttribute("tableValues",n),e.append(r)}#dr(e,t,n,r){const a=this.#ar.createElementNS(zae,"feComponentTransfer");r.append(a),this.#fr(a,"feFuncR",e),this.#fr(a,"feFuncG",t),this.#fr(a,"feFuncB",n)}#pr(e,t){const n=this.#ar.createElementNS(zae,"feComponentTransfer");t.append(n),this.#fr(n,"feFuncA",e)}#ur(e){return this.#ir.style.color=e,Oae(getComputedStyle(this.#ir).getPropertyValue("color"))}},Ece=Are?class extends uoe{async _fetch(e){return poe(e)}}:moe;function bce(e={}){"string"==typeof e||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new Vce,{docId:n}=t,r=e.url?function(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(Are&&"string"==typeof e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(e.url):null,a=e.data?function(e){if(Are&&void 0!==kL&&e instanceof kL)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return lae(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"object"==typeof e&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(e.data):null,o=e.httpHeaders||null,c=!0===e.withCredentials,i=e.password??null,l=e.range instanceof Cce?e.range:null,s=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:zce;let h=e.worker instanceof Sce?e.worker:null;const d=e.verbosity,u="string"!=typeof e.docBaseUrl||bae(e.docBaseUrl)?null:e.docBaseUrl,m="string"==typeof e.cMapUrl?e.cMapUrl:null,p=!1!==e.cMapPacked,v=e.CMapReaderFactory||yce,f="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,z=e.StandardFontDataFactory||Ece,g=!0!==e.stopAtErrors,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,M=!1!==e.isEvalSupported,E="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!Are,b="boolean"==typeof e.isImageDecoderSupported?e.isImageDecoderSupported:!Are&&(hae.platform.isFirefox||!globalThis.chrome),H=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,V="boolean"==typeof e.disableFontFace?e.disableFontFace:Are,C=!0===e.fontExtraProperties,L=!0===e.enableXfa,k=e.ownerDocument||globalThis.document,w=!0===e.disableRange,S=!0===e.disableStream,x=!0===e.disableAutoFetch,T=!0===e.pdfBug,O=e.CanvasFactory||gce,A=e.FilterFactory||Mce,R=!0===e.enableHWA,N=l?l.length:e.length??NaN,_="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!Are&&!V,D="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:v===hoe&&z===moe&&m&&f&&kae(m,document.baseURI)&&kae(f,document.baseURI);!function(e){Number.isInteger(e)&&($re=e)}(d);const P={canvasFactory:new O({ownerDocument:k,enableHWA:R}),filterFactory:new A({docId:n,ownerDocument:k}),cMapReaderFactory:D?null:new v({baseUrl:m,isCompressed:p}),standardFontDataFactory:D?null:new z({baseUrl:f})};if(!h){const e={verbosity:d,port:Boe.workerPort};h=e.port?Sce.fromPort(e):new Sce(e),t._worker=h}const F={docId:n,apiVersion:"4.10.38",data:a,password:i,disableAutoFetch:x,rangeChunkSize:s,length:N,docBaseUrl:u,enableXfa:L,evaluatorOptions:{maxImageSize:y,disableFontFace:V,ignoreErrors:g,isEvalSupported:M,isOffscreenCanvasSupported:E,isImageDecoderSupported:b,canvasMaxAreaInBytes:H,fontExtraProperties:C,useSystemFonts:_,cMapUrl:D?m:null,standardFontDataUrl:D?f:null}},I={disableFontFace:V,fontExtraProperties:C,ownerDocument:k,pdfBug:T,styleElement:null,loadingParams:{disableAutoFetch:x,enableXfa:L}};return h.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const e=h.messageHandler.sendWithPromise("GetDocRequest",F,a?[a.buffer]:null);let i;if(l)i=new qoe(l,{disableRange:w,disableStream:S});else if(!a){if(!r)throw new Error("getDocument - no `url` parameter provided.");let e;if(Are)if(kae(r)){if("undefined"==typeof fetch||"undefined"==typeof Response||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");e=rce}else e=dce;else e=kae(r)?rce:ice;i=new e({url:r,length:N,httpHeaders:o,withCredentials:c,rangeChunkSize:s,disableRange:w,disableStream:S})}return e.then((e=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const r=new ioe(n,e,h.port),a=new xce(r,t,i,I,P);t._transport=a,r.send("Ready",null)}))})).catch(t._capability.reject),t}function Hce(e){return"object"==typeof e&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class Vce{static#rr=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+Vce.#rr++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await(this._transport?.destroy())}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}}class Cce{constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const n of this._rangeListeners)n(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const n of this._progressListeners)n(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){Kre("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Lce{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Jre(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class kce{#zr=null;#gr=!1;constructor(e,t,n,r=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=r?new Lae:null,this._pdfBug=r,this.commonObjs=n.commonObjs,this.objs=new Oce,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:a=!1}={}){return new Mae({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:a})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Jre(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:n="display",annotationMode:r=Dre.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:c=null,annotationCanvasMap:i=null,pageColors:l=null,printAnnotationStorage:s=null,isEditing:h=!1}){this._stats?.time("Overall");const d=this._transport.getRenderingIntent(n,r,s,h),{renderingIntent:u,cacheKey:m}=d;this.#gr=!1,this.#yr(),c||=this._transport.getOptionalContentConfig(u);let p=this._intentStates.get(m);p||(p=Object.create(null),this._intentStates.set(m,p)),p.streamReaderCancelTimeout&&(clearTimeout(p.streamReaderCancelTimeout),p.streamReaderCancelTimeout=null);const v=!!(4&u);p.displayReadyCapability||(p.displayReadyCapability=Promise.withResolvers(),p.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(d));const f=e=>{p.renderTasks.delete(z),(this._maybeCleanupAfterRender||v)&&(this.#gr=!0),this.#Mr(!v),e?(z.capability.reject(e),this._abortOperatorList({intentState:p,reason:e instanceof Error?e:new Error(e)})):z.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},z=new Rce({callback:f,params:{canvasContext:e,viewport:t,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:i,operatorList:p.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!v,pdfBug:this._pdfBug,pageColors:l});(p.renderTasks||=new Set).add(z);const g=z.task;return Promise.all([p.displayReadyCapability.promise,c]).then((([e,t])=>{if(this.destroyed)f();else{if(this._stats?.time("Rendering"),!(t.renderingIntent&u))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");z.initializeGraphics({transparency:e,optionalContentConfig:t}),z.operatorListChanged()}})).catch(f),g}getOperatorList({intent:e="display",annotationMode:t=Dre.ENABLE,printAnnotationStorage:n=null,isEditing:r=!1}={}){const a=this._transport.getRenderingIntent(e,t,n,r,!0);let o,c=this._intentStates.get(a.cacheKey);return c||(c=Object.create(null),this._intentStates.set(a.cacheKey,c)),c.opListReadCapability||(o=Object.create(null),o.operatorListChanged=function(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(o))},c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||=new Set).add(o),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>fce.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,n){const r=t.getReader(),a={items:[],styles:Object.create(null),lang:null};!function t(){r.read().then((function({value:n,done:r}){r?e(a):(a.lang??=n.lang,Object.assign(a.styles,n.styles),a.items.push(...n.items),t())}),n)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#gr=!1,this.#yr(),Promise.all(e)}cleanup(e=!1){this.#gr=!0;const t=this.#Mr(!1);return e&&t&&(this._stats&&=new Lae),t}#Mr(e=!1){if(this.#yr(),!this.#gr||this.destroyed)return!1;if(e)return this.#zr=setTimeout((()=>{this.#zr=null,this.#Mr(!1)}),5e3),!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#gr=!1,!0}#yr(){this.#zr&&(clearTimeout(this.#zr),this.#zr=null)}_startRenderPage(e,t){const n=this._intentStates.get(t);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#Mr(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:r}){const{map:a,transfer:o}=n,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:a,modifiedIds:r},o).getReader(),i=this._intentStates.get(t);i.streamReader=c;const l=()=>{c.read().then((({value:e,done:t})=>{t?i.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,i),l())}),(e=>{if(i.streamReader=null,!this._transport.destroyed){if(i.operatorList){i.operatorList.lastChunk=!0;for(const e of i.renderTasks)e.operatorListChanged();this.#Mr(!0)}if(i.displayReadyCapability)i.displayReadyCapability.reject(e);else{if(!i.opListReadCapability)throw e;i.opListReadCapability.reject(e)}}}))};l()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(t instanceof Eae){let n=100;return t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})}),n))}}if(e.streamReader.cancel(new cae(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}class wce{#Er=new Map;#br=Promise.resolve();postMessage(e,t){const n={data:structuredClone(e,t?{transfer:t}:null)};this.#br.then((()=>{for(const[e]of this.#Er)e.call(this,n)}))}addEventListener(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){const{signal:a}=n;if(a.aborted)return void Yre("LoopbackPort - cannot use an `aborted` signal.");const o=()=>this.removeEventListener(e,t);r=()=>a.removeEventListener("abort",o),a.addEventListener("abort",o)}this.#Er.set(t,r)}removeEventListener(e,t){const n=this.#Er.get(t);n?.(),this.#Er.delete(t)}terminate(){for(const[,e]of this.#Er)e?.();this.#Er.clear()}}class Sce{static#Hr=0;static#Vr=!1;static#Cr;static{Are&&(this.#Vr=!0,Boe.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(e,t)=>{let n;try{if(n=new URL(e),!n.origin||"null"===n.origin)return!1}catch{return!1}const r=new URL(t,n);return n.origin===r.origin},this._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))}}constructor({name:e=null,port:t=null,verbosity:n=qre()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if(Sce.#Cr?.has(t))throw new Error("Cannot use more than one PDFWorker per port.");return(Sce.#Cr||=new WeakMap).set(t,this),void this._initializeFromPort(t)}this._initialize()}get promise(){return this._readyCapability.promise}#Lr(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new ioe("main","worker",e),this._messageHandler.on("ready",(function(){})),this.#Lr()}_initialize(){if(Sce.#Vr||Sce.#kr)return void this._setupFakeWorker();let{workerSrc:e}=Sce;try{Sce._isSameOrigin(window.location.href,e)||(e=Sce._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),n=new ioe("main","worker",t),r=()=>{a.abort(),n.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},a=new AbortController;t.addEventListener("error",(()=>{this._webWorker||r()}),{signal:a.signal}),n.on("test",(e=>{a.abort(),!this.destroyed&&e?(this._messageHandler=n,this._port=t,this._webWorker=t,this.#Lr()):r()})),n.on("ready",(e=>{if(a.abort(),this.destroyed)r();else try{o()}catch{this._setupFakeWorker()}}));const o=()=>{const e=new Uint8Array;n.send("test",e,[e.buffer])};return void o()}catch{Gre("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){Sce.#Vr||(Yre("Setting up fake worker."),Sce.#Vr=!0),Sce._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new wce;this._port=t;const n="fake"+Sce.#Hr++,r=new ioe(n+"_worker",n,t);e.setup(r,t),this._messageHandler=new ioe(n,n+"_worker",t),this.#Lr()})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker?.terminate(),this._webWorker=null,Sce.#Cr?.delete(this._port),this._port=null,this._messageHandler?.destroy(),this._messageHandler=null}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const t=this.#Cr?.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new Sce(e)}static get workerSrc(){if(Boe.workerSrc)return Boe.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#kr(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return Jre(this,"_setupFakeWorkerGlobal",(async()=>this.#kr?this.#kr:(await import(this.workerSrc)).WorkerMessageHandler)())}}class xce{#wr=new Map;#Sr=new Map;#xr=new Map;#Tr=new Map;#Or=null;constructor(e,t,n,r,a){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new Oce,this.fontLoader=new roe({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.cMapReaderFactory=a.cMapReaderFactory,this.standardFontDataFactory=a.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#Ar(e,t=null){const n=this.#wr.get(e);if(n)return n;const r=this.messageHandler.sendWithPromise(e,t);return this.#wr.set(e,r),r}get annotationStorage(){return Jre(this,"annotationStorage",new toe)}getRenderingIntent(e,t=Dre.ENABLE,n=null,r=!1,a=!1){let o=2,c=eoe;switch(e){case"any":o=1;break;case"display":break;case"print":o=4;break;default:Yre(`getRenderingIntent - invalid intent: ${e}`)}const i=4&o&&n instanceof noe?n:this.annotationStorage;switch(t){case Dre.DISABLE:o+=64;break;case Dre.ENABLE:break;case Dre.ENABLE_FORMS:o+=16;break;case Dre.ENABLE_STORAGE:o+=32,c=i.serializable;break;default:Yre(`getRenderingIntent - invalid annotationMode: ${t}`)}r&&(o+=128),a&&(o+=256);const{ids:l,hash:s}=i.modifiedIds;return{renderingIntent:o,cacheKey:[o,c.hash,s].join("_"),annotationStorageSerializable:c,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#Or?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#Sr.values())e.push(t._destroy());this.#Sr.clear(),this.#xr.clear(),this.#Tr.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#wr.clear(),this.filterFactory.destroy(),vce.cleanup(),this._networkStream?.cancelAllRequests(new cae("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{Xre(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:n}){n?t.close():(Xre(e instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(async e=>{await this._fullReader.headersReady;const{isStreamingSupported:n,isRangeSupported:r,contentLength:a}=this._fullReader;return n&&r||(this._lastProgress&&t.onProgress?.(this._lastProgress),this._fullReader.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),{isStreamingSupported:n,isRangeSupported:r,contentLength:a}})),e.on("GetRangeReader",((e,t)=>{Xre(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(e.begin,e.end);n?(t.onPull=()=>{n.read().then((function({value:e,done:n}){n?t.close():(Xre(e instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{n.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new Lce(e,this))})),e.on("DocException",(e=>{t._capability.reject(coe(e))})),e.on("PasswordRequest",(e=>{this.#Or=Promise.withResolvers();try{if(!t.onPassword)throw coe(e);const n=e=>{e instanceof Error?this.#Or.reject(e):this.#Or.resolve({password:e})};t.onPassword(n,e.code)}catch(e){this.#Or.reject(e)}return this.#Or.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{this.destroyed||this.#Sr.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,n,r])=>{if(this.destroyed)return null;if(this.commonObjs.has(t))return null;switch(n){case"Font":const{disableFontFace:a,fontExtraProperties:o,pdfBug:c}=this._params;if("error"in r){const e=r.error;Yre(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}const i=c&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,l=new aoe(r,{disableFontFace:a,fontExtraProperties:o,inspectFont:i});this.fontLoader.bind(l).catch((()=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!o&&l.data&&(l.data=null),this.commonObjs.resolve(t,l)}));break;case"CopyLocalImage":const{imageRef:s}=r;Xre(s,"The imageRef must be defined.");for(const e of this.#Sr.values())for(const[,n]of e.objs)if(n?.ref===s)return n.dataLen?(this.commonObjs.resolve(t,structuredClone(n)),n.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(t,r);break;default:throw new Error(`Got unknown common object type ${n}`)}return null})),e.on("obj",(([e,t,n,r])=>{if(this.destroyed)return;const a=this.#Sr.get(t);if(!a.objs.has(e))if(0!==a._intentStates.size)switch(n){case"Image":a.objs.resolve(e,r),r?.dataLen>1e7&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(e,r);break;default:throw new Error(`Got unknown object type ${n}`)}else r?.bitmap?.close()})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("FetchBuiltInCMap",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(e)})),e.on("FetchStandardFontData",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(e)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Yre("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally((()=>{this.annotationStorage.resetModified()}))}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,n=this.#xr.get(t);if(n)return n;const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&this.#Tr.set(n.refStr,e);const r=new kce(t,n,this,this._params.pdfBug);return this.#Sr.set(t,r),r}));return this.#xr.set(t,r),r}getPageIndex(e){return Hce(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#Ar("GetFieldObjects")}hasJSActions(){return this.#Ar("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#Ar("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#Ar("GetOptionalContentConfig").then((t=>new $oe(t,e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=this.#wr.get(e);if(t)return t;const n=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new joe(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#wr.set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#Sr.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#wr.clear(),this.filterFactory.destroy(!0),vce.cleanup()}}cachedPageNumber(e){if(!Hce(e))return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#Tr.get(t)??null}}const Tce=Symbol("INITIAL_DATA");class Oce{#Rr=Object.create(null);#Nr(e){return this.#Rr[e]||={...Promise.withResolvers(),data:Tce}}get(e,t=null){if(t){const n=this.#Nr(e);return n.promise.then((()=>t(n.data))),null}const n=this.#Rr[e];if(!n||n.data===Tce)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const t=this.#Rr[e];return!!t&&t.data!==Tce}delete(e){const t=this.#Rr[e];return!(!t||t.data===Tce||(delete this.#Rr[e],0))}resolve(e,t=null){const n=this.#Nr(e);n.data=t,n.resolve()}clear(){for(const e in this.#Rr){const{data:t}=this.#Rr[e];t?.bitmap?.close()}this.#Rr=Object.create(null)}*[Symbol.iterator](){for(const e in this.#Rr){const{data:t}=this.#Rr[e];t!==Tce&&(yield[e,t])}}}class Ace{#_r=null;constructor(e){this.#_r=e,this.onContinue=null}get promise(){return this.#_r.capability.promise}cancel(e=0){this.#_r.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#_r.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#_r;return e.form||e.canvas&&t?.size>0}}class Rce{#Dr=null;static#Pr=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:a,operatorList:o,pageIndex:c,canvasFactory:i,filterFactory:l,useRequestAnimationFrame:s=!1,pdfBug:h=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=c,this.canvasFactory=i,this.filterFactory=l,this._pdfBug=h,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===s&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Ace(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(Rce.#Pr.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Rce.#Pr.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:r,transform:a,background:o}=this.params;this.gfx=new Ioe(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:a,viewport:r,transparency:e,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#Dr&&(window.cancelAnimationFrame(this.#Dr),this.#Dr=null),Rce.#Pr.delete(this._canvas),this.callback(e||new Eae(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#Dr=window.requestAnimationFrame((()=>{this.#Dr=null,this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),Rce.#Pr.delete(this._canvas),this.callback())))}}const Nce="4.10.38",_ce="f9bea397f";function Dce(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function Pce(e){return Math.max(0,Math.min(255,255*e))}class Fce{static CMYK_G([e,t,n,r]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return[e=Pce(e),e,e]}static G_HTML([e]){const t=Dce(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return["G",.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(Pce)}static RGB_HTML(e){return`#${e.map(Dce).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return["RGB",1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,r]){return[Pce(1-Math.min(1,e+r)),Pce(1-Math.min(1,n+r)),Pce(1-Math.min(1,t+r))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){const r=1-e,a=1-t,o=1-n;return["CMYK",r,a,o,Math.min(r,a,o)]}}class Ice{create(e,t,n=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),n||(r.setAttribute("width",`${e}px`),r.setAttribute("height",`${t}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e} ${t}`),r}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Kre("Abstract method `_createSVG` called.")}}class Bce extends Ice{_createSVG(e){return document.createElementNS(zae,e)}}class jce{static setupStorage(e,t,n,r,a){const o=r.getValue(t,{value:null});switch(n.name){case"textarea":if(null!==o.value&&(e.textContent=o.value),"print"===a)break;e.addEventListener("input",(e=>{r.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===n.attributes.type||"checkbox"===n.attributes.type){if(o.value===n.attributes.xfaOn?e.setAttribute("checked",!0):o.value===n.attributes.xfaOff&&e.removeAttribute("checked"),"print"===a)break;e.addEventListener("change",(e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==o.value&&e.setAttribute("value",o.value),"print"===a)break;e.addEventListener("input",(e=>{r.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==o.value){e.setAttribute("value",o.value);for(const e of n.children)e.attributes.value===o.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",(e=>{const n=e.target.options,a=-1===n.selectedIndex?"":n[n.selectedIndex].value;r.setValue(t,{value:a})}))}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:a}){const{attributes:o}=t,c=e instanceof HTMLAnchorElement;"radio"===o.type&&(o.name=`${o.name}-${r}`);for(const[t,n]of Object.entries(o))if(null!=n)switch(t){case"class":n.length&&e.setAttribute(t,n.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",n);break;case"style":Object.assign(e.style,n);break;case"textContent":e.textContent=n;break;default:(!c||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,n)}c&&a.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,t,n)}static render(e){const t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,a=e.intent||"display",o=document.createElement(r.name);r.attributes&&this.setAttributes({html:o,element:r,intent:a,linkService:n});const c="richText"!==a,i=e.div;if(i.append(o),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;i.style.transform=t}c&&i.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===r.children.length){if(r.value){const e=document.createTextNode(r.value);o.append(e),c&&fce.shouldBuildText(r.name)&&l.push(e)}return{textDivs:l}}const s=[[r,-1,o]];for(;s.length>0;){const[e,r,o]=s.at(-1);if(r+1===e.children.length){s.pop();continue}const i=e.children[++s.at(-1)[1]];if(null===i)continue;const{name:h}=i;if("#text"===h){const e=document.createTextNode(i.value);l.push(e),o.append(e);continue}const d=i?.attributes?.xmlns?document.createElementNS(i.attributes.xmlns,h):document.createElement(h);if(o.append(d),i.attributes&&this.setAttributes({html:d,element:i,storage:t,intent:a,linkService:n}),i.children?.length>0)s.push([i,-1,d]);else if(i.value){const e=document.createTextNode(i.value);c&&fce.shouldBuildText(h)&&l.push(e),d.append(e)}}for(const e of i.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:l}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const Uce=1e3,Wce=new WeakSet;function $ce(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class qce{static create(e){switch(e.data.annotationType){case 2:return new Yce(e);case 1:return new Kce(e);case 20:switch(e.data.fieldType){case"Tx":return new Qce(e);case"Btn":return e.data.radioButton?new eie(e):e.data.checkBox?new Zce(e):new tie(e);case"Ch":return new nie(e);case"Sig":return new Jce(e)}return new Xce(e);case 16:return new rie(e);case 3:return new oie(e);case 4:return new cie(e);case 5:return new iie(e);case 6:return new lie(e);case 8:return new sie(e);case 14:return new die(e);case 15:return new uie(e);case 7:return new hie(e);case 9:return new mie(e);case 10:return new pie(e);case 11:return new vie(e);case 12:return new fie(e);case 13:return new zie(e);case 17:return new gie(e);default:return new Gce(e)}}}class Gce{#Fr=null;#Ir=!1;#Br=null;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(n)),r&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:n}){return!!(e?.str||t?.str||n?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Gce._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;this.#Fr||={rect:this.data.rect.slice(0)};const{rect:t}=e;t&&this.#jr(t),this.#Br?.popup.updateEdited(e)}resetEdited(){this.#Fr&&(this.#jr(this.#Fr.rect),this.#Br?.popup.resetEdited(),this.#Fr=null)}#jr(e){const{container:{style:t},data:{rect:n,rotation:r},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:o,pageX:c,pageY:i}}}}=this;n?.splice(0,4,...e);const{width:l,height:s}=$ce(e);t.left=100*(e[0]-c)/a+"%",t.top=100*(o-e[3]+i)/o+"%",0===r?(t.width=100*l/a+"%",t.height=100*s/o+"%"):this.setRotation(r)}_createContainer(e){const{data:t,parent:{page:n,viewport:r}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",t.id),this instanceof Xce||(a.tabIndex=Uce);const{style:o}=a;if(o.zIndex=this.parent.zIndex++,t.alternativeText&&(a.title=t.alternativeText),t.noRotate&&a.classList.add("norotate"),!t.rect||this instanceof rie){const{rotation:e}=t;return t.hasOwnCanvas||0===e||this.setRotation(e,a),a}const{width:c,height:i}=$ce(t.rect);if(!e&&t.borderStyle.width>0){o.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;if(e>0||n>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${n}px * var(--scale-factor))`;o.borderRadius=t}else if(this instanceof eie){const e=`calc(${c}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;o.borderRadius=e}switch(t.borderStyle.style){case 1:o.borderStyle="solid";break;case 2:o.borderStyle="dashed";break;case 3:Yre("Unimplemented border style: beveled");break;case 4:Yre("Unimplemented border style: inset");break;case 5:o.borderBottomStyle="solid"}const r=t.borderColor||null;r?(this.#Ir=!0,o.borderColor=uae.makeHexColor(0|r[0],0|r[1],0|r[2])):o.borderWidth=0}const l=uae.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:s,pageHeight:h,pageX:d,pageY:u}=r.rawDims;o.left=100*(l[0]-d)/s+"%",o.top=100*(l[1]-u)/h+"%";const{rotation:m}=t;return t.hasOwnCanvas||0===m?(o.width=100*c/s+"%",o.height=100*i/h+"%"):this.setRotation(m,a),a}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims,{width:a,height:o}=$ce(this.data.rect);let c,i;e%180==0?(c=100*a/n,i=100*o/r):(c=100*o/n,i=100*a/r),t.style.width=`${c}%`,t.style.height=`${i}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,n)=>{const r=n.detail[e],a=r[0],o=r.slice(1);n.target.style[t]=Fce[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[t]:Fce[`${a}_rgb`](o)})};return Jre(this,"_commonActions",{display:e=>{const{display:t}=e.detail,n=t%2==1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const n=this._commonActions;for(const r of Object.keys(t.detail)){const a=e[r]||n[r];a?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const n=this._commonActions;for(const[r,a]of Object.entries(t)){const o=n[r];o&&(o({detail:{[r]:a},target:e}),delete t[r])}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,n,r,a]=this.data.rect.map((e=>Math.fround(e)));if(8===e.length){const[o,c,i,l]=e.subarray(2,6);if(r===o&&a===c&&t===i&&n===l)return}const{style:o}=this.container;let c;if(this.#Ir){const{borderColor:e,borderWidth:t}=o;o.borderWidth=0,c=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add("hasBorder")}const i=r-t,l=a-n,{svgFactory:s}=this,h=s.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0);const d=s.createElement("defs");h.append(d);const u=s.createElement("clipPath"),m=`clippath_${this.data.id}`;u.setAttribute("id",m),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let n=2,r=e.length;n<r;n+=8){const r=e[n],o=e[n+1],h=e[n+2],d=e[n+3],m=s.createElement("rect"),p=(h-t)/i,v=(a-o)/l,f=(r-h)/i,z=(o-d)/l;m.setAttribute("x",p),m.setAttribute("y",v),m.setAttribute("width",f),m.setAttribute("height",z),u.append(m),c?.push(`<rect vector-effect="non-scaling-stroke" x="${p}" y="${v}" width="${f}" height="${z}"/>`)}this.#Ir&&(c.push("</g></svg>')"),o.backgroundImage=c.join("")),this.container.append(h),this.container.style.clipPath=`url(#${m})`}_createPopup(){const{data:e}=this,t=this.#Br=new rie({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(t.render())}render(){Kre("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const n=[];if(this._fieldObjects){const r=this._fieldObjects[e];if(r)for(const{page:e,id:a,exportValues:o}of r){if(-1===e)continue;if(a===t)continue;const r="string"==typeof o?o:null,c=document.querySelector(`[data-element-id="${a}"]`);!c||Wce.has(c)?n.push({id:a,exportValue:r,domElement:c}):Yre(`_getElementsByName - element not allowed: ${a}`)}return n}for(const r of document.getElementsByName(e)){const{exportValue:e}=r,a=r.getAttribute("data-element-id");a!==t&&Wce.has(r)&&n.push({id:a,exportValue:e,domElement:r})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})}))}}class Yce extends Gce{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action),r=!0):e.attachment?(this.#Ur(n,e.attachment,e.attachmentDest),r=!0):e.setOCGState?(this.#Wr(n,e.setOCGState),r=!0):e.dest?(this._bindLink(n,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&this.container.append(n),this.container}#$r(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#$r()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#$r()}#Ur(e,t,n=null){e.href=this.linkService.getAnchorUrl(""),t.description&&(e.title=t.description),e.onclick=()=>(this.downloadManager?.openOrDownloadData(t.content,t.filename,n),!1),this.#$r()}#Wr(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#$r()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(t.actions)){const a=n.get(r);a&&(e[a]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:r}}),!1))}e.onclick||(e.onclick=()=>!1),this.#$r()}_bindResetFormAction(e,t){const n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),this.#$r(),!this._fieldObjects)return Yre('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(n||(e.onclick=()=>!1));e.onclick=()=>{n?.();const{fields:e,refs:r,include:a}=t,o=[];if(0!==e.length||0!==r.length){const t=new Set(r);for(const n of e){const e=this._fieldObjects[n]||[];for(const{id:n}of e)t.add(n)}for(const e of Object.values(this._fieldObjects))for(const n of e)t.has(n.id)===a&&o.push(n)}else for(const e of Object.values(this._fieldObjects))o.push(...e);const c=this.annotationStorage,i=[];for(const e of o){const{id:t}=e;switch(i.push(t),e.type){case"text":{const n=e.defaultValue||"";c.setValue(t,{value:n});break}case"checkbox":case"radiobutton":{const n=e.defaultValue===e.exportValues;c.setValue(t,{value:n});break}case"combobox":case"listbox":{const n=e.defaultValue||"";c.setValue(t,{value:n});break}default:continue}const n=document.querySelector(`[data-element-id="${t}"]`);n&&(Wce.has(n)?n.dispatchEvent(new Event("resetform")):Yre(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:i,name:"ResetForm"}}),!1}}}class Kce extends Gce{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class Xce extends Gce{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&("CANVAS"===e.previousSibling?.nodeName&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return hae.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,r,a){n.includes("mouse")?e.addEventListener(n,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:a(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(n,(e=>{if("blur"===n){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if("focus"===n){if(t.focused)return;t.focused=!0}a&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:a(e)}})}))}_setEventListeners(e,t,n,r){for(const[a,o]of n)("Action"===o||this.data.actions?.[o])&&("Focus"!==o&&"Blur"!==o||(t||={focused:!1}),this._setEventListener(e,t,a,o,r),"Focus"!==o||this.data.actions?.Blur?"Blur"!==o||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":uae.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const{fontColor:t}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,r=e.style;let a;const o=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(_re*n))||1);a=Math.min(n,o(t/_re))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(n,o(e/_re))}r.fontSize=`calc(${a}px * var(--scale-factor))`,r.color=uae.makeHexColor(t[0],t[1],t[2]),null!==this.data.textAlignment&&(r.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class Qce extends Xce{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,n,r){const a=this.annotationStorage;for(const o of this._getElementsByName(e.name,e.id))o.domElement&&(o.domElement[t]=n),a.setValue(o.id,{[r]:n})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const r=e.getValue(t,{value:this.data.fieldValue});let a=r.value||"";const o=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;o&&a.length>o&&(a=a.slice(0,o));let c=r.formattedValue||this.data.textContent?.join("\n")||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const i={userValue:a,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=c??a,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",c??a),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Wce.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=Uce,this._setRequired(n,this.data.required),o&&(n.maxLength=o),n.addEventListener("input",(r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,"value",r.target.value,"value"),i.formattedValue=null})),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";n.value=i.userValue=t,i.formattedValue=null}));let l=e=>{const{formattedValue:t}=i;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",(e=>{if(i.focused)return;const{target:t}=e;i.userValue&&(t.value=i.userValue),i.lastCommittedValue=t.value,i.commitKey=1,this.data.actions?.Focus||(i.focused=!0)})),n.addEventListener("updatefromsandbox",(n=>{this.showElementAndHideCanvas(n.target);const r={value(n){i.userValue=n.detail.value??"",e.setValue(t,{value:i.userValue.toString()}),n.target.value=i.userValue},formattedValue(n){const{formattedValue:r}=n.detail;i.formattedValue=r,null!=r&&n.target!==document.activeElement&&(n.target.value=r),e.setValue(t,{formattedValue:r})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{const{charLimit:r}=n.detail,{target:a}=n;if(0===r)return void a.removeAttribute("maxLength");a.setAttribute("maxLength",r);let o=i.userValue;!o||o.length<=r||(o=o.slice(0,r),a.value=i.userValue=o,e.setValue(t,{value:o}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:o,willCommit:!0,commitKey:1,selStart:a.selectionStart,selEnd:a.selectionEnd}}))}};this._dispatchEventFromSandbox(r,n)})),n.addEventListener("keydown",(e=>{i.commitKey=1;let n=-1;if("Escape"===e.key?n=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(i.commitKey=3):n=2,-1===n)return;const{value:r}=e.target;i.lastCommittedValue!==r&&(i.lastCommittedValue=r,i.userValue=r,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const r=l;l=null,n.addEventListener("blur",(e=>{if(!i.focused||!e.relatedTarget)return;this.data.actions?.Blur||(i.focused=!1);const{value:n}=e.target;i.userValue=n,i.lastCommittedValue!==n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:i.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)})),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",(e=>{i.lastCommittedValue=null;const{data:n,target:r}=e,{value:a,selectionStart:o,selectionEnd:c}=r;let l=o,s=c;switch(e.inputType){case"deleteWordBackward":{const e=a.substring(0,o).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=a.substring(o).match(/^[^\w]*\w*/);e&&(s+=e[0].length);break}case"deleteContentBackward":o===c&&(l-=1);break;case"deleteContentForward":o===c&&(s+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,change:n||"",willCommit:!1,selStart:l,selEnd:s}})})),this._setEventListeners(n,i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(l&&n.addEventListener("blur",l),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/o;n.classList.add("comb"),n.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Jce extends Xce{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class Zce extends Xce{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;"string"==typeof r&&(r="Off"!==r,e.setValue(n,{value:r})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const a=document.createElement("input");return Wce.add(a),a.setAttribute("data-element-id",n),a.disabled=t.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=t.fieldName,r&&a.setAttribute("checked",!0),a.setAttribute("exportValue",t.exportValue),a.tabIndex=Uce,a.addEventListener("change",(r=>{const{name:a,checked:o}=r.target;for(const r of this._getElementsByName(a,n)){const n=o&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:o})})),a.addEventListener("resetform",(e=>{const n=t.defaultFieldValue||"Off";e.target.checked=n===t.exportValue})),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",(t=>{const r={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(n,{value:t.target.checked})}};this._dispatchEventFromSandbox(r,t)})),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class eie extends Xce{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;if("string"==typeof r&&(r=r!==t.buttonValue,e.setValue(n,{value:r})),r)for(const r of this._getElementsByName(t.fieldName,n))e.setValue(r.id,{value:!1});const a=document.createElement("input");if(Wce.add(a),a.setAttribute("data-element-id",n),a.disabled=t.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=t.fieldName,r&&a.setAttribute("checked",!0),a.tabIndex=Uce,a.addEventListener("change",(t=>{const{name:r,checked:a}=t.target;for(const t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:a})})),a.addEventListener("resetform",(e=>{const n=t.defaultFieldValue;e.target.checked=null!=n&&n===t.buttonValue})),this.enableScripting&&this.hasJSActions){const r=t.buttonValue;a.addEventListener("updatefromsandbox",(t=>{const a={value:t=>{const a=r===t.detail.value;for(const r of this._getElementsByName(t.target.name)){const t=a&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}};this._dispatchEventFromSandbox(a,t)})),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class tie extends Yce{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class nie extends Xce{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement("select");Wce.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=Uce;let a=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of r.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),a=!1),r.append(t)}let o=null;if(a){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),r.prepend(e),o=()=>{e.remove(),r.removeEventListener("input",o),o=null},r.addEventListener("input",o)}const c=e=>{const t=e?"value":"textContent",{options:n,multiple:a}=r;return a?Array.prototype.filter.call(n,(e=>e.selected)).map((e=>e[t])):-1===n.selectedIndex?null:n[n.selectedIndex][t]};let i=c(!1);const l=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",(n=>{const a={value(n){o?.();const a=n.detail.value,l=new Set(Array.isArray(a)?a:[a]);for(const e of r.options)e.selected=l.has(e.value);e.setValue(t,{value:c(!0)}),i=c(!1)},multipleSelection(e){r.multiple=!0},remove(n){const a=r.options,o=n.detail.remove;a[o].selected=!1,r.remove(o),a.length>0&&-1===Array.prototype.findIndex.call(a,(e=>e.selected))&&(a[0].selected=!0),e.setValue(t,{value:c(!0),items:l(n)}),i=c(!1)},clear(n){for(;0!==r.length;)r.remove(0);e.setValue(t,{value:null,items:[]}),i=c(!1)},insert(n){const{index:a,displayValue:o,exportValue:s}=n.detail.insert,h=r.children[a],d=document.createElement("option");d.textContent=o,d.value=s,h?h.before(d):r.append(d),e.setValue(t,{value:c(!0),items:l(n)}),i=c(!1)},items(n){const{items:a}=n.detail;for(;0!==r.length;)r.remove(0);for(const e of a){const{displayValue:t,exportValue:n}=e,a=document.createElement("option");a.textContent=t,a.value=n,r.append(a)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:c(!0),items:l(n)}),i=c(!1)},indices(n){const r=new Set(n.detail.indices);for(const e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:c(!0)}),i=c(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(a,n)})),r.addEventListener("input",(n=>{const r=c(!0),a=c(!1);e.setValue(t,{value:r}),n.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,change:a,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(r,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))):r.addEventListener("input",(function(n){e.setValue(t,{value:c(!0)})})),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class rie extends Gce{constructor(e){const{data:t,elements:n}=e;super(e,{isRenderable:Gce._hasPopupData(t)}),this.elements=n,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new aie({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const n of this.elements)n.popup=e,n.container.ariaHasPopup="dialog",t.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",t.map((e=>`${fae}${e}`)).join(",")),this.container}}class aie{#qr=this.#Gr.bind(this);#Yr=this.#Kr.bind(this);#Xr=this.#Qr.bind(this);#Jr=this.#Zr.bind(this);#ea=null;#me=null;#ta=null;#na=null;#ra=null;#aa=null;#oa=null;#ca=!1;#ia=null;#L=null;#la=null;#sa=null;#ha=null;#Fr=null;#da=!1;constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:a,contentsObj:o,richText:c,parent:i,rect:l,parentRect:s,open:h}){this.#me=e,this.#ha=r,this.#ta=o,this.#sa=c,this.#aa=i,this.#ea=t,this.#la=l,this.#oa=s,this.#ra=n,this.#na=xae.toDateObject(a),this.trigger=n.flatMap((e=>e.getElementsToTriggerPopup()));for(const e of this.trigger)e.addEventListener("click",this.#Jr),e.addEventListener("mouseenter",this.#Xr),e.addEventListener("mouseleave",this.#Yr),e.classList.add("popupTriggerArea");for(const e of n)e.container?.addEventListener("keydown",this.#qr);this.#me.hidden=!0,h&&this.#Zr()}render(){if(this.#ia)return;const e=this.#ia=document.createElement("div");if(e.className="popup",this.#ea){const t=e.style.outlineColor=uae.makeHexColor(...this.#ea);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`;else{const t=.7;e.style.backgroundColor=uae.makeHexColor(...this.#ea.map((e=>Math.floor(t*(255-e)+e))))}}const t=document.createElement("span");t.className="header";const n=document.createElement("h1");if(t.append(n),({dir:n.dir,str:n.textContent}=this.#ha),e.append(t),this.#na){const e=document.createElement("span");e.classList.add("popupDate"),e.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),e.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#na.valueOf()})),t.append(e)}const r=this.#ua;if(r)jce.render({xfaHtml:r,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const t=this._formatContents(this.#ta);e.append(t)}this.#me.append(e)}get#ua(){const e=this.#sa,t=this.#ta;return!e?.str||t?.str&&t.str!==e.str?null:this.#sa.html||null}get#ma(){return this.#ua?.attributes?.style?.fontSize||0}get#pa(){return this.#ua?.attributes?.style?.color||null}#va(e){const t=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},r={style:{color:this.#pa,fontSize:this.#ma?`calc(${this.#ma}px * var(--scale-factor))`:""}};for(const n of e.split("\n"))t.push({name:"span",value:n,attributes:r});return n}_formatContents({str:e,dir:t}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=t;const r=e.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){const a=r[e];n.append(document.createTextNode(a)),e<t-1&&n.append(document.createElement("br"))}return n}#Gr(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||("Enter"===e.key||"Escape"===e.key&&this.#ca)&&this.#Zr()}updateEdited({rect:e,popupContent:t}){this.#Fr||={contentsObj:this.#ta,richText:this.#sa},e&&(this.#L=null),t&&(this.#sa=this.#va(t),this.#ta=null),this.#ia?.remove(),this.#ia=null}resetEdited(){this.#Fr&&(({contentsObj:this.#ta,richText:this.#sa}=this.#Fr),this.#Fr=null,this.#ia?.remove(),this.#ia=null,this.#L=null)}#fa(){if(null!==this.#L)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:r,pageY:a}}}=this.#aa;let o=!!this.#oa,c=o?this.#oa:this.#la;for(const e of this.#ra)if(!c||null!==uae.intersect(e.data.rect,c)){c=e.data.rect,o=!0;break}const i=uae.normalizeRect([c[0],e[3]-c[1]+e[1],c[2],e[3]-c[3]+e[1]]),l=o?c[2]-c[0]+5:0,s=i[0]+l,h=i[1];this.#L=[100*(s-r)/t,100*(h-a)/n];const{style:d}=this.#me;d.left=`${this.#L[0]}%`,d.top=`${this.#L[1]}%`}#Zr(){this.#ca=!this.#ca,this.#ca?(this.#Qr(),this.#me.addEventListener("click",this.#Jr),this.#me.addEventListener("keydown",this.#qr)):(this.#Kr(),this.#me.removeEventListener("click",this.#Jr),this.#me.removeEventListener("keydown",this.#qr))}#Qr(){this.#ia||this.render(),this.isVisible?this.#ca&&this.#me.classList.add("focused"):(this.#fa(),this.#me.hidden=!1,this.#me.style.zIndex=parseInt(this.#me.style.zIndex)+1e3)}#Kr(){this.#me.classList.remove("focused"),!this.#ca&&this.isVisible&&(this.#me.hidden=!0,this.#me.style.zIndex=parseInt(this.#me.style.zIndex)-1e3)}forceHide(){this.#da=this.isVisible,this.#da&&(this.#me.hidden=!0)}maybeShow(){this.#da&&(this.#ia||this.#Qr(),this.#da=!1,this.#me.hidden=!1)}get isVisible(){return!1===this.#me.hidden}}class oie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Pre.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const n=document.createElement("span");n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class cie extends Gce{#za=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:t,height:n}=$ce(e.rect),r=this.svgFactory.create(t,n,!0),a=this.#za=this.svgFactory.createElement("svg:line");return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#za}addHighlightArea(){this.container.classList.add("highlightArea")}}class iie extends Gce{#ga=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:t,height:n}=$ce(e.rect),r=this.svgFactory.create(t,n,!0),a=e.borderStyle.width,o=this.#ga=this.svgFactory.createElement("svg:rect");return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",t-a),o.setAttribute("height",n-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#ga}addHighlightArea(){this.container.classList.add("highlightArea")}}class lie extends Gce{#ya=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:t,height:n}=$ce(e.rect),r=this.svgFactory.create(t,n,!0),a=e.borderStyle.width,o=this.#ya=this.svgFactory.createElement("svg:ellipse");return o.setAttribute("cx",t/2),o.setAttribute("cy",n/2),o.setAttribute("rx",t/2-a/2),o.setAttribute("ry",n/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#ya}addHighlightArea(){this.container.classList.add("highlightArea")}}class sie extends Gce{#Ma=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:t,borderStyle:n,popupRef:r}}=this;if(!t)return this.container;const{width:a,height:o}=$ce(e),c=this.svgFactory.create(a,o,!0);let i=[];for(let n=0,r=t.length;n<r;n+=2){const r=t[n]-e[0],a=e[3]-t[n+1];i.push(`${r},${a}`)}i=i.join(" ");const l=this.#Ma=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",i),l.setAttribute("stroke-width",n.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),c.append(l),this.container.append(c),!r&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Ma}addHighlightArea(){this.container.classList.add("highlightArea")}}class hie extends sie{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class die extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class uie extends Gce{#Ea=null;#ba=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?Pre.HIGHLIGHT:Pre.INK}#Ha(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:t,inkLists:n,borderStyle:r,popupRef:a}}=this,{transform:o,width:c,height:i}=this.#Ha(t,e),l=this.svgFactory.create(c,i,!0),s=this.#Ea=this.svgFactory.createElement("svg:g");l.append(s),s.setAttribute("stroke-width",r.width||1),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("stroke-miterlimit",10),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),s.setAttribute("transform",o);for(let e=0,t=n.length;e<t;e++){const t=this.svgFactory.createElement(this.svgElementName);this.#ba.push(t),t.setAttribute("points",n[e].join(",")),s.append(t)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:t,points:n,rect:r}=e,a=this.#Ea;if(t>=0&&a.setAttribute("stroke-width",t||1),n)for(let e=0,t=this.#ba.length;e<t;e++)this.#ba[e].setAttribute("points",n[e].join(","));if(r){const{transform:e,width:t,height:n}=this.#Ha(this.data.rotation,r);a.parentElement.setAttribute("viewBox",`0 0 ${t} ${n}`),a.setAttribute("transform",e)}}getElementsToTriggerPopup(){return this.#ba}addHighlightArea(){this.container.classList.add("highlightArea")}}class mie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Pre.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class pie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class vie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class fie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class zie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Pre.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class gie extends Gce{#Va=null;constructor(e){super(e,{isRenderable:!0});const{file:t}=this.data;this.filename=t.filename,this.content=t.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let n;t.hasAppearance||0===t.fillAlpha?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(100*t.fillAlpha)}%);`)),n.addEventListener("dblclick",this.#Ca.bind(this)),this.#Va=n;const{isMac:r}=hae.platform;return e.addEventListener("keydown",(e=>{"Enter"===e.key&&(r?e.metaKey:e.ctrlKey)&&this.#Ca()})),!t.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return this.#Va}addHighlightArea(){this.container.classList.add("highlightArea")}#Ca(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class yie{#La=null;#ka=null;#wa=new Map;#Sa=null;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:r,page:a,viewport:o,structTreeLayer:c}){this.div=e,this.#La=t,this.#ka=n,this.#Sa=c||null,this.page=a,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=r}hasEditableAnnotations(){return this.#wa.size>0}async#xa(e,t){const n=e.firstChild||e,r=n.id=`${fae}${t}`,a=await(this.#Sa?.getAriaAttributes(r));if(a)for(const[e,t]of a)n.setAttribute(e,t);this.div.append(e),this.#La?.moveElementInDOM(this.div,e,n,!1)}async render(e){const{annotations:t}=e,n=this.div;Nae(n,this.viewport);const r=new Map,a={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new Bce,annotationStorage:e.annotationStorage||new toe,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=16===e.annotationType;if(t){const t=r.get(e.id);if(!t)continue;a.elements=t}else{const{width:t,height:n}=$ce(e.rect);if(t<=0||n<=0)continue}a.data=e;const n=qce.create(a);if(!n.isRenderable)continue;if(!t&&e.popupRef){const t=r.get(e.popupRef);t?t.push(n):r.set(e.popupRef,[n])}const o=n.render();e.hidden&&(o.style.visibility="hidden"),await this.#xa(o,e.id),n._isEditable&&(this.#wa.set(n.data.id,n),this._annotationEditorUIManager?.renderAnnotationElement(n))}this.#Ta()}update({viewport:e}){const t=this.div;this.viewport=e,Nae(t,{rotation:e.rotation}),this.#Ta(),t.hidden=!1}#Ta(){if(!this.#ka)return;const e=this.div;for(const[t,n]of this.#ka){const r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;n.className="annotationContent";const{firstChild:a}=r;a?"CANVAS"===a.nodeName?a.replaceWith(n):a.classList.contains("annotationContent")?a.after(n):a.before(n):r.append(n)}this.#ka.clear()}getEditableAnnotations(){return Array.from(this.#wa.values())}getEditableAnnotation(e){return this.#wa.get(e)}}const Mie=/\r\n?|\n/g;class Eie extends Yae{#ea;#Oa="";#Aa=`${this.id}-editor`;#Ra=null;#ma;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=Eie.prototype,t=e=>e.isEmpty(),n=$ae.TRANSLATE_SMALL,r=$ae.TRANSLATE_BIG;return Jre(this,"_keyboardManager",new Uae([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[n,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:t}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,n],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:t}]]))}static _type="freetext";static _editorType=Pre.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"}),this.#ea=e.color||Eie._defaultColor||Yae._defaultLineColor,this.#ma=e.fontSize||Eie._defaultFontSize}static initialize(e,t){Yae.initialize(e,t);const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case Fre.FREETEXT_SIZE:Eie._defaultFontSize=t;break;case Fre.FREETEXT_COLOR:Eie._defaultColor=t}}updateParams(e,t){switch(e){case Fre.FREETEXT_SIZE:this.#Na(t);break;case Fre.FREETEXT_COLOR:this.#_a(t)}}static get defaultPropertiesToUpdate(){return[[Fre.FREETEXT_SIZE,Eie._defaultFontSize],[Fre.FREETEXT_COLOR,Eie._defaultColor||Yae._defaultLineColor]]}get propertiesToUpdate(){return[[Fre.FREETEXT_SIZE,this.#ma],[Fre.FREETEXT_COLOR,this.#ea]]}#Na(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#ma)*this.parentScale),this.#ma=e,this.#Da()},n=this.#ma;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Fre.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#_a(e){const t=e=>{this.#ea=this.editorDiv.style.color=e},n=this.#ea;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Fre.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-Eie._internalPadding*e,-(Eie._internalPadding+this.#ma)*e]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(Pre.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#Ra=new AbortController;const e=this._uiManager.combinedSignal(this.#Ra);this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#Aa),this._isDraggable=!0,this.#Ra?.abort(),this.#Ra=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#Pa(){const e=[];this.editorDiv.normalize();let t=null;for(const n of this.editorDiv.childNodes)t?.nodeType===Node.TEXT_NODE&&"BR"===n.nodeName||(e.push(Eie.#Fa(n)),t=n);return e.join("\n")}#Da(){const[e,t]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:e,div:t}=this,r=t.style.display,a=t.classList.contains("hidden");t.classList.remove("hidden"),t.style.display="hidden",e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r,t.classList.toggle("hidden",a)}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=this.#Oa,t=this.#Oa=this.#Pa().trimEnd();if(e===t)return;const n=e=>{this.#Oa=e,e?(this.#Ia(),this._uiManager.rebuild(this),this.#Da()):this.remove()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#Da()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Eie._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#Aa),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#ma}px * var(--scale-factor))`,n.color=this.#ea,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Fae(this,this.div,["dblclick","keydown"]),this.width){const[n,r]=this.parentDimensions;if(this.annotationElementId){const{position:a}=this._initialData;let[o,c]=this.getInitialTranslation();[o,c]=this.pageTranslationToScreen(o,c);const[i,l]=this.pageDimensions,[s,h]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=e+(a[0]-s)/i,u=t+this.height-(a[1]-h)/l;break;case 90:d=e+(a[0]-s)/i,u=t-(a[1]-h)/l,[o,c]=[c,-o];break;case 180:d=e-this.width+(a[0]-s)/i,u=t-(a[1]-h)/l,[o,c]=[-o,-c];break;case 270:d=e+(a[0]-s-this.height*l)/i,u=t+(a[1]-h-this.width*i)/l,[o,c]=[-c,o]}this.setAt(d*n,u*r,o,c)}else this.setAt(e*n,t*r,this.width*n,this.height*r);this.#Ia(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#Fa(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Mie,"")}editorDivPaste(e){const t=e.clipboardData||window.clipboardData,{types:n}=t;if(1===n.length&&"text/plain"===n[0])return;e.preventDefault();const r=Eie.#Ba(t.getData("text")||"").replaceAll(Mie,"\n");if(!r)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!r.includes("\n"))return o.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),void a.collapseToStart();const{startContainer:c,startOffset:i}=o,l=[],s=[];if(c.nodeType===Node.TEXT_NODE){const e=c.parentElement;if(s.push(c.nodeValue.slice(i).replaceAll(Mie,"")),e!==this.editorDiv){let t=l;for(const n of this.editorDiv.childNodes)n!==e?t.push(Eie.#Fa(n)):t=s}l.push(c.nodeValue.slice(0,i).replaceAll(Mie,""))}else if(c===this.editorDiv){let e=l,t=0;for(const n of this.editorDiv.childNodes)t++===i&&(e=s),e.push(Eie.#Fa(n))}this.#Oa=`${l.join("\n")}${r}${s.join("\n")}`,this.#Ia();const h=new Range;let d=l.reduce(((e,t)=>e+t.length),0);for(const{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){const t=e.nodeValue.length;if(d<=t){h.setStart(e,d),h.setEnd(e,d);break}d-=t}a.removeAllRanges(),a.addRange(h)}#Ia(){if(this.editorDiv.replaceChildren(),this.#Oa)for(const e of this.#Oa.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}#ja(){return this.#Oa.replaceAll(" "," ")}static#Ba(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}static async deserialize(e,t,n){let r=null;if(e instanceof oie){const{data:{defaultAppearanceData:{fontSize:t,fontColor:n},rect:a,rotation:o,id:c,popupRef:i},textContent:l,textPosition:s,parent:{page:{pageNumber:h}}}=e;if(!l||0===l.length)return null;r=e={annotationType:Pre.FREETEXT,color:Array.from(n),fontSize:t,value:l.join("\n"),position:s,pageIndex:h-1,rect:a.slice(0),rotation:o,id:c,deleted:!1,popupRef:i}}const a=await super.deserialize(e,t,n);return a.#ma=e.fontSize,a.#ea=uae.makeHexColor(...e.color),a.#Oa=Eie.#Ba(e.value),a.annotationElementId=e.id||null,a._initialData=r,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=Eie._internalPadding*this.parentScale,n=this.getRect(t,t),r=Yae._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#ea),a={annotationType:Pre.FREETEXT,color:r,fontSize:this.#ma,value:this.#ja(),pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!this.#Ua(a)?null:(a.id=this.annotationElementId,a)}#Ua(e){const{value:t,fontSize:n,color:r,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some(((e,t)=>e!==r[t]))||e.pageIndex!==a}renderAnnotationElement(e){const t=super.renderAnnotationElement(e);if(this.deleted)return t;const{style:n}=t;n.fontSize=`calc(${this.#ma}px * var(--scale-factor))`,n.color=this.#ea,t.replaceChildren();for(const e of this.#Oa.split("\n")){const n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),t.append(n)}const r=Eie._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(r,r),popupContent:this.#Oa}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class bie{static PRECISION=1e-4;toSVGPath(){Kre("Abstract method `toSVGPath` must be implemented.")}get box(){Kre("Abstract getter `box` must be implemented.")}serialize(e,t){Kre("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,r,a,o){o||=new Float32Array(e.length);for(let c=0,i=e.length;c<i;c+=2)o[c]=t+e[c]*r,o[c+1]=n+e[c+1]*a;return o}static _rescaleAndSwap(e,t,n,r,a,o){o||=new Float32Array(e.length);for(let c=0,i=e.length;c<i;c+=2)o[c]=t+e[c+1]*r,o[c+1]=n+e[c]*a;return o}static _translate(e,t,n,r){r||=new Float32Array(e.length);for(let a=0,o=e.length;a<o;a+=2)r[a]=t+e[a],r[a+1]=n+e[a+1];return r}static svgRound(e){return Math.round(1e4*e)}static _normalizePoint(e,t,n,r,a){switch(a){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static _normalizePagePoint(e,t,n){switch(n){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,n,r,a,o){return[(e+5*n)/6,(t+5*r)/6,(5*n+a)/6,(5*r+o)/6,(n+a)/2,(r+o)/2]}}class Hie{#Wa;#$a=[];#qa;#Ga;#Ya=[];#Ka=new Float32Array(18);#Xa;#Qa;#Ja;#Za;#eo;#to;#no=[];static#ro=8;static#ao=2;static#oo=Hie.#ro+Hie.#ao;constructor({x:e,y:t},n,r,a,o,c=0){this.#Wa=n,this.#to=a*r,this.#Ga=o,this.#Ka.set([NaN,NaN,NaN,NaN,e,t],6),this.#qa=c,this.#Za=Hie.#ro*r,this.#Ja=Hie.#oo*r,this.#eo=r,this.#no.push(e,t)}isEmpty(){return isNaN(this.#Ka[8])}#co(){const e=this.#Ka.subarray(4,6),t=this.#Ka.subarray(16,18),[n,r,a,o]=this.#Wa;return[(this.#Xa+(e[0]-t[0])/2-n)/a,(this.#Qa+(e[1]-t[1])/2-r)/o,(this.#Xa+(t[0]-e[0])/2-n)/a,(this.#Qa+(t[1]-e[1])/2-r)/o]}add({x:e,y:t}){this.#Xa=e,this.#Qa=t;const[n,r,a,o]=this.#Wa;let[c,i,l,s]=this.#Ka.subarray(8,12);const h=e-l,d=t-s,u=Math.hypot(h,d);if(u<this.#Ja)return!1;const m=u-this.#Za,p=m/u,v=p*h,f=p*d;let z=c,g=i;c=l,i=s,l+=v,s+=f,this.#no?.push(e,t);const y=v/m,M=-f/m*this.#to,E=y*this.#to;return this.#Ka.set(this.#Ka.subarray(2,8),0),this.#Ka.set([l+M,s+E],4),this.#Ka.set(this.#Ka.subarray(14,18),12),this.#Ka.set([l-M,s-E],16),isNaN(this.#Ka[6])?(0===this.#Ya.length&&(this.#Ka.set([c+M,i+E],2),this.#Ya.push(NaN,NaN,NaN,NaN,(c+M-n)/a,(i+E-r)/o),this.#Ka.set([c-M,i-E],14),this.#$a.push(NaN,NaN,NaN,NaN,(c-M-n)/a,(i-E-r)/o)),this.#Ka.set([z,g,c,i,l,s],6),!this.isEmpty()):(this.#Ka.set([z,g,c,i,l,s],6),Math.abs(Math.atan2(g-i,z-c)-Math.atan2(f,v))<Math.PI/2?([c,i,l,s]=this.#Ka.subarray(2,6),this.#Ya.push(NaN,NaN,NaN,NaN,((c+l)/2-n)/a,((i+s)/2-r)/o),[c,i,z,g]=this.#Ka.subarray(14,18),this.#$a.push(NaN,NaN,NaN,NaN,((z+c)/2-n)/a,((g+i)/2-r)/o),!0):([z,g,c,i,l,s]=this.#Ka.subarray(0,6),this.#Ya.push(((z+5*c)/6-n)/a,((g+5*i)/6-r)/o,((5*c+l)/6-n)/a,((5*i+s)/6-r)/o,((c+l)/2-n)/a,((i+s)/2-r)/o),[l,s,c,i,z,g]=this.#Ka.subarray(12,18),this.#$a.push(((z+5*c)/6-n)/a,((g+5*i)/6-r)/o,((5*c+l)/6-n)/a,((5*i+s)/6-r)/o,((c+l)/2-n)/a,((i+s)/2-r)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const e=this.#Ya,t=this.#$a;if(isNaN(this.#Ka[6])&&!this.isEmpty())return this.#io();const n=[];n.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?n.push(`L${e[t+4]} ${e[t+5]}`):n.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#lo(n);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#so(n),n.join(" ")}#io(){const[e,t,n,r]=this.#Wa,[a,o,c,i]=this.#co();return`M${(this.#Ka[2]-e)/n} ${(this.#Ka[3]-t)/r} L${(this.#Ka[4]-e)/n} ${(this.#Ka[5]-t)/r} L${a} ${o} L${c} ${i} L${(this.#Ka[16]-e)/n} ${(this.#Ka[17]-t)/r} L${(this.#Ka[14]-e)/n} ${(this.#Ka[15]-t)/r} Z`}#so(e){const t=this.#$a;e.push(`L${t[4]} ${t[5]} Z`)}#lo(e){const[t,n,r,a]=this.#Wa,o=this.#Ka.subarray(4,6),c=this.#Ka.subarray(16,18),[i,l,s,h]=this.#co();e.push(`L${(o[0]-t)/r} ${(o[1]-n)/a} L${i} ${l} L${s} ${h} L${(c[0]-t)/r} ${(c[1]-n)/a}`)}newFreeDrawOutline(e,t,n,r,a,o){return new Vie(e,t,n,r,a,o)}getOutlines(){const e=this.#Ya,t=this.#$a,n=this.#Ka,[r,a,o,c]=this.#Wa,i=new Float32Array((this.#no?.length??0)+2);for(let e=0,t=i.length-2;e<t;e+=2)i[e]=(this.#no[e]-r)/o,i[e+1]=(this.#no[e+1]-a)/c;if(i[i.length-2]=(this.#Xa-r)/o,i[i.length-1]=(this.#Qa-a)/c,isNaN(n[6])&&!this.isEmpty())return this.#ho(i);const l=new Float32Array(this.#Ya.length+24+this.#$a.length);let s=e.length;for(let t=0;t<s;t+=2)isNaN(e[t])?l[t]=l[t+1]=NaN:(l[t]=e[t],l[t+1]=e[t+1]);s=this.#do(l,s);for(let e=t.length-6;e>=6;e-=6)for(let n=0;n<6;n+=2)isNaN(t[e+n])?(l[s]=l[s+1]=NaN,s+=2):(l[s]=t[e+n],l[s+1]=t[e+n+1],s+=2);return this.#uo(l,s),this.newFreeDrawOutline(l,i,this.#Wa,this.#eo,this.#qa,this.#Ga)}#ho(e){const t=this.#Ka,[n,r,a,o]=this.#Wa,[c,i,l,s]=this.#co(),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(t[2]-n)/a,(t[3]-r)/o,NaN,NaN,NaN,NaN,(t[4]-n)/a,(t[5]-r)/o,NaN,NaN,NaN,NaN,c,i,NaN,NaN,NaN,NaN,l,s,NaN,NaN,NaN,NaN,(t[16]-n)/a,(t[17]-r)/o,NaN,NaN,NaN,NaN,(t[14]-n)/a,(t[15]-r)/o],0),this.newFreeDrawOutline(h,e,this.#Wa,this.#eo,this.#qa,this.#Ga)}#uo(e,t){const n=this.#$a;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+6}#do(e,t){const n=this.#Ka.subarray(4,6),r=this.#Ka.subarray(16,18),[a,o,c,i]=this.#Wa,[l,s,h,d]=this.#co();return e.set([NaN,NaN,NaN,NaN,(n[0]-a)/c,(n[1]-o)/i,NaN,NaN,NaN,NaN,l,s,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(r[0]-a)/c,(r[1]-o)/i],t),t+24}}class Vie extends bie{#Wa;#mo=new Float32Array(4);#qa;#Ga;#no;#eo;#po;constructor(e,t,n,r,a,o){super(),this.#po=e,this.#no=t,this.#Wa=n,this.#eo=r,this.#qa=a,this.#Ga=o,this.lastPoint=[NaN,NaN],this.#vo(o);const[c,i,l,s]=this.#mo;for(let t=0,n=e.length;t<n;t+=2)e[t]=(e[t]-c)/l,e[t+1]=(e[t+1]-i)/s;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-c)/l,t[e+1]=(t[e+1]-i)/s}toSVGPath(){const e=[`M${this.#po[4]} ${this.#po[5]}`];for(let t=6,n=this.#po.length;t<n;t+=6)isNaN(this.#po[t])?e.push(`L${this.#po[t+4]} ${this.#po[t+5]}`):e.push(`C${this.#po[t]} ${this.#po[t+1]} ${this.#po[t+2]} ${this.#po[t+3]} ${this.#po[t+4]} ${this.#po[t+5]}`);return e.push("Z"),e.join(" ")}serialize([e,t,n,r],a){const o=n-e,c=r-t;let i,l;switch(a){case 0:i=bie._rescale(this.#po,e,r,o,-c),l=bie._rescale(this.#no,e,r,o,-c);break;case 90:i=bie._rescaleAndSwap(this.#po,e,t,o,c),l=bie._rescaleAndSwap(this.#no,e,t,o,c);break;case 180:i=bie._rescale(this.#po,n,t,-o,c),l=bie._rescale(this.#no,n,t,-o,c);break;case 270:i=bie._rescaleAndSwap(this.#po,n,r,-o,-c),l=bie._rescaleAndSwap(this.#no,n,r,-o,-c)}return{outline:Array.from(i),points:[Array.from(l)]}}#vo(e){const t=this.#po;let n=t[4],r=t[5],a=n,o=r,c=n,i=r,l=n,s=r;const h=e?Math.max:Math.min;for(let e=6,d=t.length;e<d;e+=6){if(isNaN(t[e]))a=Math.min(a,t[e+4]),o=Math.min(o,t[e+5]),c=Math.max(c,t[e+4]),i=Math.max(i,t[e+5]),s<t[e+5]?(l=t[e+4],s=t[e+5]):s===t[e+5]&&(l=h(l,t[e+4]));else{const d=uae.bezierBoundingBox(n,r,...t.slice(e,e+6));a=Math.min(a,d[0]),o=Math.min(o,d[1]),c=Math.max(c,d[2]),i=Math.max(i,d[3]),s<d[3]?(l=d[2],s=d[3]):s===d[3]&&(l=h(l,d[2]))}n=t[e+4],r=t[e+5]}const d=this.#mo;d[0]=a-this.#qa,d[1]=o-this.#qa,d[2]=c-a+2*this.#qa,d[3]=i-o+2*this.#qa,this.lastPoint=[l,s]}get box(){return this.#mo}newOutliner(e,t,n,r,a,o=0){return new Hie(e,t,n,r,a,o)}getNewOutline(e,t){const[n,r,a,o]=this.#mo,[c,i,l,s]=this.#Wa,h=a*l,d=o*s,u=n*l+c,m=r*s+i,p=this.newOutliner({x:this.#no[0]*h+u,y:this.#no[1]*d+m},this.#Wa,this.#eo,e,this.#Ga,t??this.#qa);for(let e=2;e<this.#no.length;e+=2)p.add({x:this.#no[e]*h+u,y:this.#no[e+1]*d+m});return p.getOutlines()}}class Cie{#Wa;#fo;#zo=[];#go=[];constructor(e,t=0,n=0,r=!0){let a=1/0,o=-1/0,c=1/0,i=-1/0;const l=10**-4;for(const{x:n,y:r,width:s,height:h}of e){const e=Math.floor((n-t)/l)*l,d=Math.ceil((n+s+t)/l)*l,u=Math.floor((r-t)/l)*l,m=Math.ceil((r+h+t)/l)*l,p=[e,u,m,!0],v=[d,u,m,!1];this.#zo.push(p,v),a=Math.min(a,e),o=Math.max(o,d),c=Math.min(c,u),i=Math.max(i,m)}const s=o-a+2*n,h=i-c+2*n,d=a-n,u=c-n,m=this.#zo.at(r?-1:-2),p=[m[0],m[2]];for(const e of this.#zo){const[t,n,r]=e;e[0]=(t-d)/s,e[1]=(n-u)/h,e[2]=(r-u)/h}this.#Wa=new Float32Array([d,u,s,h]),this.#fo=p}getOutlines(){this.#zo.sort(((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]));const e=[];for(const t of this.#zo)t[3]?(e.push(...this.#yo(t)),this.#Mo(t)):(this.#Eo(t),e.push(...this.#yo(t)));return this.#bo(e)}#bo(e){const t=[],n=new Set;for(const n of e){const[e,r,a]=n;t.push([e,r,n],[e,a,n])}t.sort(((e,t)=>e[1]-t[1]||e[0]-t[0]));for(let e=0,r=t.length;e<r;e+=2){const r=t[e][2],a=t[e+1][2];r.push(a),a.push(r),n.add(r),n.add(a)}const r=[];let a;for(;n.size>0;){const e=n.values().next().value;let[t,o,c,i,l]=e;n.delete(e);let s=t,h=o;for(a=[t,c],r.push(a);;){let e;if(n.has(i))e=i;else{if(!n.has(l))break;e=l}n.delete(e),[t,o,c,i,l]=e,s!==t&&(a.push(s,h,t,h===o?o:c),s=t),h=h===o?c:o}a.push(s,h)}return new Lie(r,this.#Wa,this.#fo)}#Ho(e){const t=this.#go;let n=0,r=t.length-1;for(;n<=r;){const a=n+r>>1,o=t[a][0];if(o===e)return a;o<e?n=a+1:r=a-1}return r+1}#Mo([,e,t]){const n=this.#Ho(e);this.#go.splice(n,0,[e,t])}#Eo([,e,t]){const n=this.#Ho(e);for(let r=n;r<this.#go.length;r++){const[n,a]=this.#go[r];if(n!==e)break;if(n===e&&a===t)return void this.#go.splice(r,1)}for(let r=n-1;r>=0;r--){const[n,a]=this.#go[r];if(n!==e)break;if(n===e&&a===t)return void this.#go.splice(r,1)}}#yo(e){const[t,n,r]=e,a=[[t,n,r]],o=this.#Ho(r);for(let e=0;e<o;e++){const[n,r]=this.#go[e];for(let e=0,o=a.length;e<o;e++){const[,c,i]=a[e];if(!(r<=c||i<=n))if(c>=n)if(i>r)a[e][1]=r;else{if(1===o)return[];a.splice(e,1),e--,o--}else a[e][2]=n,i>r&&a.push([t,r,i])}}return a}}class Lie extends bie{#Wa;#Vo;constructor(e,t,n){super(),this.#Vo=e,this.#Wa=t,this.lastPoint=n}toSVGPath(){const e=[];for(const t of this.#Vo){let[n,r]=t;e.push(`M${n} ${r}`);for(let a=2;a<t.length;a+=2){const o=t[a],c=t[a+1];o===n?(e.push(`V${c}`),r=c):c===r&&(e.push(`H${o}`),n=o)}e.push("Z")}return e.join(" ")}serialize([e,t,n,r],a){const o=[],c=n-e,i=r-t;for(const t of this.#Vo){const n=new Array(t.length);for(let a=0;a<t.length;a+=2)n[a]=e+t[a]*c,n[a+1]=r-t[a+1]*i;o.push(n)}return o}get box(){return this.#Wa}get classNamesForOutlining(){return["highlightOutline"]}}class kie extends Hie{newFreeDrawOutline(e,t,n,r,a,o){return new wie(e,t,n,r,a,o)}}class wie extends Vie{newOutliner(e,t,n,r,a,o=0){return new kie(e,t,n,r,a,o)}}class Sie{#Co=null;#Lo=null;#ko;#wo=null;#So=!1;#xo=!1;#o=null;#To;#Oo=null;#v=null;#Ao;static#Ro=null;static get _keyboardManager(){return Jre(this,"_keyboardManager",new Uae([[["Escape","mac+Escape"],Sie.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Sie.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Sie.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Sie.prototype._moveToPrevious],[["Home","mac+Home"],Sie.prototype._moveToBeginning],[["End","mac+End"],Sie.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:t=null}){e?(this.#xo=!1,this.#Ao=Fre.HIGHLIGHT_COLOR,this.#o=e):(this.#xo=!0,this.#Ao=Fre.HIGHLIGHT_DEFAULT_COLOR),this.#v=e?._uiManager||t,this.#To=this.#v._eventBus,this.#ko=e?.color||this.#v?.highlightColors.values().next().value||"#FFFF98",Sie.#Ro||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const e=this.#Co=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=this.#v._signal;e.addEventListener("click",this.#No.bind(this),{signal:t}),e.addEventListener("keydown",this.#Gr.bind(this),{signal:t});const n=this.#Lo=document.createElement("span");return n.className="swatch",n.setAttribute("aria-hidden",!0),n.style.backgroundColor=this.#ko,e.append(n),e}renderMainDropdown(){const e=this.#wo=this.#_o();return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}#_o(){const e=document.createElement("div"),t=this.#v._signal;e.addEventListener("contextmenu",wae,{signal:t}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[n,r]of this.#v.highlightColors){const a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",r),a.title=n,a.setAttribute("data-l10n-id",Sie.#Ro[n]);const o=document.createElement("span");a.append(o),o.className="swatch",o.style.backgroundColor=r,a.setAttribute("aria-selected",r===this.#ko),a.addEventListener("click",this.#Do.bind(this,r),{signal:t}),e.append(a)}return e.addEventListener("keydown",this.#Gr.bind(this),{signal:t}),e}#Do(e,t){t.stopPropagation(),this.#To.dispatch("switchannotationeditorparams",{source:this,type:this.#Ao,value:e})}_colorSelectFromKeyboard(e){if(e.target===this.#Co)return void this.#No(e);const t=e.target.getAttribute("data-color");t&&this.#Do(t,e)}_moveToNext(e){this.#Po?e.target!==this.#Co?e.target.nextSibling?.focus():this.#wo.firstChild?.focus():this.#No(e)}_moveToPrevious(e){e.target!==this.#wo?.firstChild&&e.target!==this.#Co?(this.#Po||this.#No(e),e.target.previousSibling?.focus()):this.#Po&&this._hideDropdownFromKeyboard()}_moveToBeginning(e){this.#Po?this.#wo.firstChild?.focus():this.#No(e)}_moveToEnd(e){this.#Po?this.#wo.lastChild?.focus():this.#No(e)}#Gr(e){Sie._keyboardManager.exec(this,e)}#No(e){if(this.#Po)return void this.hideDropdown();if(this.#So=0===e.detail,this.#Oo||(this.#Oo=new AbortController,window.addEventListener("pointerdown",this.#s.bind(this),{signal:this.#v.combinedSignal(this.#Oo)})),this.#wo)return void this.#wo.classList.remove("hidden");const t=this.#wo=this.#_o();this.#Co.append(t)}#s(e){this.#wo?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#wo?.classList.add("hidden"),this.#Oo?.abort(),this.#Oo=null}get#Po(){return this.#wo&&!this.#wo.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#xo||(this.#Po?(this.hideDropdown(),this.#Co.focus({preventScroll:!0,focusVisible:this.#So})):this.#o?.unselect())}updateColor(e){if(this.#Lo&&(this.#Lo.style.backgroundColor=e),!this.#wo)return;const t=this.#v.highlightColors.values();for(const n of this.#wo.children)n.setAttribute("aria-selected",t.next().value===e)}destroy(){this.#Co?.remove(),this.#Co=null,this.#Lo=null,this.#wo?.remove(),this.#wo=null}}class xie extends Yae{#Fo=null;#Io=0;#Bo;#jo=null;#a=null;#Uo=null;#Wo=null;#$o=0;#qo=null;#Go=null;#y=null;#Yo=!1;#fo=null;#Ko;#Xo=null;#Qo="";#to;#Jo="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=Pre.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const e=xie.prototype;return Jre(this,"_keyboardManager",new Uae([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"}),this.color=e.color||xie._defaultColor,this.#to=e.thickness||xie._defaultThickness,this.#Ko=e.opacity||xie._defaultOpacity,this.#Bo=e.boxes||null,this.#Jo=e.methodOfCreation||"",this.#Qo=e.text||"",this._isDraggable=!1,e.highlightId>-1?(this.#Yo=!0,this.#Zo(e),this.#ec()):this.#Bo&&(this.#Fo=e.anchorNode,this.#Io=e.anchorOffset,this.#Wo=e.focusNode,this.#$o=e.focusOffset,this.#tc(),this.#ec(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#Yo?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#to,methodOfCreation:this.#Jo}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#tc(){const e=new Cie(this.#Bo,.001);this.#Go=e.getOutlines(),[this.x,this.y,this.width,this.height]=this.#Go.box;const t=new Cie(this.#Bo,.0025,.001,"ltr"===this._uiManager.direction);this.#Uo=t.getOutlines();const{lastPoint:n}=this.#Uo;this.#fo=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height]}#Zo({highlightOutlines:e,highlightId:t,clipPathId:n}){if(this.#Go=e,this.#Uo=e.getNewOutline(this.#to/2+1.5,.0025),t>=0)this.#y=t,this.#jo=n,this.parent.drawLayer.finalizeDraw(t,{bbox:e.box,path:{d:e.toSVGPath()}}),this.#Xo=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#Uo.box,path:{d:this.#Uo.toSVGPath()}},!0);else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#y,{bbox:xie.#nc(this.#Go.box,(t-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#Xo,{bbox:xie.#nc(this.#Uo.box,t),path:{d:this.#Uo.toSVGPath()}})}const[r,a,o,c]=e.box;switch(this.rotation){case 0:this.x=r,this.y=a,this.width=o,this.height=c;break;case 90:{const[e,t]=this.parentDimensions;this.x=a,this.y=1-r,this.width=o*t/e,this.height=c*e/t;break}case 180:this.x=1-r,this.y=1-a,this.width=o,this.height=c;break;case 270:{const[e,t]=this.parentDimensions;this.x=1-a,this.y=r,this.width=o*t/e,this.height=c*e/t;break}}const{lastPoint:i}=this.#Uo;this.#fo=[(i[0]-r)/o,(i[1]-a)/c]}static initialize(e,t){Yae.initialize(e,t),xie._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case Fre.HIGHLIGHT_DEFAULT_COLOR:xie._defaultColor=t;break;case Fre.HIGHLIGHT_THICKNESS:xie._defaultThickness=t}}translateInPage(e,t){}get toolbarPosition(){return this.#fo}updateParams(e,t){switch(e){case Fre.HIGHLIGHT_COLOR:this.#_a(t);break;case Fre.HIGHLIGHT_THICKNESS:this.#rc(t)}}static get defaultPropertiesToUpdate(){return[[Fre.HIGHLIGHT_DEFAULT_COLOR,xie._defaultColor],[Fre.HIGHLIGHT_THICKNESS,xie._defaultThickness]]}get propertiesToUpdate(){return[[Fre.HIGHLIGHT_COLOR,this.color||xie._defaultColor],[Fre.HIGHLIGHT_THICKNESS,this.#to||xie._defaultThickness],[Fre.HIGHLIGHT_FREE,this.#Yo]]}#_a(e){const t=(e,t)=>{this.color=e,this.#Ko=t,this.parent?.drawLayer.updateProperties(this.#y,{root:{fill:e,"fill-opacity":t}}),this.#a?.updateColor(e)},n=this.color,r=this.#Ko;this.addCommands({cmd:t.bind(this,e,xie._defaultOpacity),undo:t.bind(this,n,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Fre.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)}#rc(e){const t=this.#to,n=e=>{this.#to=e,this.#ac(e)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Fre.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(this.#a=new Sie({editor:this}),e.addColorPicker(this.#a)),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#oc())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#oc())}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this.#cc(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#ec(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#cc():e&&(this.#ec(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),t&&this.select()}#ac(e){if(!this.#Yo)return;this.#Zo({highlightOutlines:this.#Go.getNewOutline(e/2)}),this.fixAndSetPosition();const[t,n]=this.parentDimensions;this.setDims(this.width*t,this.height*n)}#cc(){null!==this.#y&&this.parent&&(this.parent.drawLayer.remove(this.#y),this.#y=null,this.parent.drawLayer.remove(this.#Xo),this.#Xo=null)}#ec(e=this.parent){null===this.#y&&(({id:this.#y,clipPathId:this.#jo}=e.drawLayer.draw({bbox:this.#Go.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.#Ko},rootClass:{highlight:!0,free:this.#Yo},path:{d:this.#Go.toSVGPath()}},!1,!0)),this.#Xo=e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#Yo},bbox:this.#Uo.box,path:{d:this.#Uo.toSVGPath()}},this.#Yo),this.#qo&&(this.#qo.style.clipPath=this.#jo))}static#nc([e,t,n,r],a){switch(a){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}rotate(e){const{drawLayer:t}=this.parent;let n;this.#Yo?(e=(e-this.rotation+360)%360,n=xie.#nc(this.#Go.box,e)):n=xie.#nc([this.x,this.y,this.width,this.height],e),t.updateProperties(this.#y,{bbox:n,root:{"data-main-rotation":e}}),t.updateProperties(this.#Xo,{bbox:xie.#nc(this.#Uo.box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();this.#Qo&&(e.setAttribute("aria-label",this.#Qo),e.setAttribute("role","mark")),this.#Yo?e.classList.add("free"):this.div.addEventListener("keydown",this.#ic.bind(this),{signal:this._uiManager._signal});const t=this.#qo=document.createElement("div");e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#jo;const[n,r]=this.parentDimensions;return this.setDims(this.width*n,this.height*r),Fae(this,this.#qo,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#Xo,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#Xo,{rootClass:{hovered:!1}})}#ic(e){xie._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#lc(!0);break;case 1:case 3:this.#lc(!1)}}#lc(e){if(!this.#Fo)return;const t=window.getSelection();e?t.setPosition(this.#Fo,this.#Io):t.setPosition(this.#Wo,this.#$o)}select(){super.select(),this.#Xo&&this.parent?.drawLayer.updateProperties(this.#Xo,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#Xo&&(this.parent?.drawLayer.updateProperties(this.#Xo,{rootClass:{selected:!1}}),this.#Yo||this.#lc(!1))}get _mustFixPosition(){return!this.#Yo}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(this.#y,{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(this.#Xo,{rootClass:{hidden:!e}}))}#oc(){return this.#Yo?this.rotation:0}#sc(){if(this.#Yo)return null;const[e,t]=this.pageDimensions,[n,r]=this.pageTranslation,a=this.#Bo,o=new Float32Array(8*a.length);let c=0;for(const{x:i,y:l,width:s,height:h}of a){const a=i*e+n,d=(1-l)*t+r;o[c]=o[c+4]=a,o[c+1]=o[c+3]=d,o[c+2]=o[c+6]=a+s*e,o[c+5]=o[c+7]=d-h*t,c+=8}return o}#hc(e){return this.#Go.serialize(e,this.#oc())}static startHighlighting(e,t,{target:n,x:r,y:a}){const{x:o,y:c,width:i,height:l}=n.getBoundingClientRect(),s=new AbortController,h=e.combinedSignal(s),d=t=>{s.abort(),this.#dc(e,t)};window.addEventListener("blur",d,{signal:h}),window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("pointerdown",Sae,{capture:!0,passive:!1,signal:h}),window.addEventListener("contextmenu",wae,{signal:h}),n.addEventListener("pointermove",this.#uc.bind(this,e),{signal:h}),this._freeHighlight=new kie({x:r,y:a},[o,c,i,l],e.scale,this._defaultThickness/2,t,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0))}static#uc(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#dc(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,n){let r=null;if(e instanceof mie){const{data:{quadPoints:t,rect:n,rotation:a,id:o,color:c,opacity:i,popupRef:l},parent:{page:{pageNumber:s}}}=e;r=e={annotationType:Pre.HIGHLIGHT,color:Array.from(c),opacity:i,quadPoints:t,boxes:null,pageIndex:s-1,rect:n.slice(0),rotation:a,id:o,deleted:!1,popupRef:l}}else if(e instanceof uie){const{data:{inkLists:t,rect:n,rotation:a,id:o,color:c,borderStyle:{rawWidth:i},popupRef:l},parent:{page:{pageNumber:s}}}=e;r=e={annotationType:Pre.HIGHLIGHT,color:Array.from(c),thickness:i,inkLists:t,boxes:null,pageIndex:s-1,rect:n.slice(0),rotation:a,id:o,deleted:!1,popupRef:l}}const{color:a,quadPoints:o,inkLists:c,opacity:i}=e,l=await super.deserialize(e,t,n);l.color=uae.makeHexColor(...a),l.#Ko=i||1,c&&(l.#to=e.thickness),l.annotationElementId=e.id||null,l._initialData=r;const[s,h]=l.pageDimensions,[d,u]=l.pageTranslation;if(o){const e=l.#Bo=[];for(let t=0;t<o.length;t+=8)e.push({x:(o[t]-d)/s,y:1-(o[t+1]-u)/h,width:(o[t+2]-o[t])/s,height:(o[t+1]-o[t+5])/h});l.#tc(),l.#ec(),l.rotate(l.rotation)}else if(c){l.#Yo=!0;const e=c[0],n={x:e[0]-d,y:h-(e[1]-u)},r=new kie(n,[0,0,s,h],1,l.#to/2,!0,.001);for(let t=0,a=e.length;t<a;t+=2)n.x=e[t]-d,n.y=h-(e[t+1]-u),r.add(n);const{id:a,clipPathId:o}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:l.color,"fill-opacity":l._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:r.toSVGPath()}},!0,!0);l.#Zo({highlightOutlines:r.getOutlines(),highlightId:a,clipPathId:o}),l.#ec()}return l}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const t=this.getRect(0,0),n=Yae._colorManager.convert(this.color),r={annotationType:Pre.HIGHLIGHT,color:n,opacity:this.#Ko,thickness:this.#to,quadPoints:this.#sc(),outlines:this.#hc(t),pageIndex:this.pageIndex,rect:t,rotation:this.#oc(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#Ua(r)?null:(r.id=this.annotationElementId,r)}#Ua(e){const{color:t}=this._initialData;return e.color.some(((e,n)=>e!==t[n]))}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class Tie{#mc=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,n]of Object.entries(e))this.updateProperty(t,n)}updateSVGProperty(e,t){this.#mc[e]=t}toSVGProperties(){const e=this.#mc;return this.#mc=Object.create(null),{root:e}}reset(){this.#mc=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){Kre("Not implemented")}}class Oie extends Yae{#pc=null;#vc;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#fc=null;static#zc=null;static#gc=null;static#yc=NaN;static#Mc=null;static#Ec=null;static#bc=NaN;static _INNER_MARGIN=3;constructor(e){super(e),this.#vc=e.mustBeCommitted||!1,e.drawOutlines&&(this.#Hc(e),this.#ec())}#Hc({drawOutlines:e,drawId:t,drawingOptions:n}){this.#pc=e,this._drawingOptions||=n,t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties)):this._drawId=this.#Vc(e,this.parent),this.#Cc(e.box)}#Vc(e,t){const{id:n}=t.drawLayer.draw(Oie._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(e,t){const n=new Set(Object.keys(e));for(const[r,a]of Object.entries(t))n.has(r)?Object.assign(e[r],a):e[r]=a;return e}static getDefaultDrawingOptions(e){Kre("Not implemented")}static get typesMap(){Kre("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){const n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,t),this._currentParent&&(Oie.#fc.updateProperty(n,t),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){const n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){const e=[],t=this._defaultDrawingOptions;for(const[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:t}=this;for(const[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,n){const r=this._drawingOptions,a=r[t],o=e=>{r.updateProperty(t,e);const n=this.#pc.updateProperty(t,e);n&&this.#Cc(n),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties())};this.addCommands({cmd:o.bind(this,n),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Oie._mergeSVGProperties(this.#pc.getPathResizingSVGProperties(this.#Lc()),{bbox:this.#kc()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Oie._mergeSVGProperties(this.#pc.getPathResizedSVGProperties(this.#Lc()),{bbox:this.#kc()}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#kc(e,t)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Oie._mergeSVGProperties(this.#pc.getPathTranslatedSVGProperties(this.#Lc(),this.parentDimensions),{bbox:this.#kc()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#vc&&(this.#vc=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this.#cc(),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#ec(),this.#Cc(this.#pc.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#cc()):e&&(this._uiManager.addShouldRescale(this),this.#ec(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),t&&this.select()}#cc(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#ec(e=this.parent){null!==this._drawId&&this.parent===e||(null===this._drawId?(this._drawingOptions.updateAll(),this._drawId=this.#Vc(this.#pc,e)):this.parent.drawLayer.updateParent(this._drawId,e.drawLayer))}#wc([e,t,n,r]){const{parentDimensions:[a,o],rotation:c}=this;switch(c){case 90:return[t,1-e,n*(o/a),r*(a/o)];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,n*(o/a),r*(a/o)];default:return[e,t,n,r]}}#Lc(){const{x:e,y:t,width:n,height:r,parentDimensions:[a,o],rotation:c}=this;switch(c){case 90:return[1-t,e,n*(a/o),r*(o/a)];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,n*(a/o),r*(o/a)];default:return[e,t,n,r]}}#Cc(e){if([this.x,this.y,this.width,this.height]=this.#wc(e),this.div){this.fixAndSetPosition();const[e,t]=this.parentDimensions;this.setDims(this.width*e,this.height*t)}this._onResized()}#kc(){const{x:e,y:t,width:n,height:r,rotation:a,parentRotation:o,parentDimensions:[c,i]}=this;switch((4*a+o)/90){case 1:return[1-t-r,e,r,n];case 2:return[1-e-n,1-t-r,n,r];case 3:return[t,1-e-n,r,n];case 4:return[e,t-n*(c/i),r*(i/c),n*(c/i)];case 5:return[1-t,e,n*(c/i),r*(i/c)];case 6:return[1-e-r*(i/c),1-t,r*(i/c),n*(c/i)];case 7:return[t-n*(c/i),1-e-r*(i/c),n*(c/i),r*(i/c)];case 8:return[e-n,t-r,n,r];case 9:return[1-t,e-n,r,n];case 10:return[1-e,1-t,n,r];case 11:return[t-r,1-e,r,n];case 12:return[e-r*(i/c),t,r*(i/c),n*(c/i)];case 13:return[1-t-n*(c/i),e-r*(i/c),n*(c/i),r*(i/c)];case 14:return[1-e,1-t-n*(c/i),r*(i/c),n*(c/i)];case 15:return[t,1-e,n*(c/i),r*(i/c)];default:return[e,t,n,r]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,Oie._mergeSVGProperties({bbox:this.#kc()},this.#pc.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#Cc(this.#pc.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;const e=super.render();e.classList.add("draw");const t=document.createElement("div");e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal";const[n,r]=this.parentDimensions;return this.setDims(this.width*n,this.height*r),this._uiManager.addShouldRescale(this),this.disableEditing(),e}static createDrawerInstance(e,t,n,r,a){Kre("Not implemented")}static startDrawing(e,t,n,r){const{target:a,offsetX:o,offsetY:c,pointerId:i,pointerType:l}=r;if(Oie.#Mc&&Oie.#Mc!==l)return;const{viewport:{rotation:s}}=e,{width:h,height:d}=a.getBoundingClientRect(),u=Oie.#zc=new AbortController,m=e.combinedSignal(u);Oie.#yc||=i,Oie.#Mc??=l,window.addEventListener("pointerup",(e=>{Oie.#yc===e.pointerId?this._endDraw(e):Oie.#Ec?.delete(e.pointerId)}),{signal:m}),window.addEventListener("pointercancel",(e=>{Oie.#yc===e.pointerId?this._currentParent.endDrawingSession():Oie.#Ec?.delete(e.pointerId)}),{signal:m}),window.addEventListener("pointerdown",(e=>{Oie.#Mc===e.pointerType&&((Oie.#Ec||=new Set).add(e.pointerId),Oie.#fc.isCancellable()&&(Oie.#fc.removeLastElement(),Oie.#fc.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))}),{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",wae,{signal:m}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),a.addEventListener("touchmove",(e=>{e.timeStamp===Oie.#bc&&Sae(e)}),{signal:m}),e.toggleDrawing(),t._editorUndoBar?.hide(),Oie.#fc?e.drawLayer.updateProperties(this._currentDrawId,Oie.#fc.startNew(o,c,h,d,s)):(t.updateUIForDefaultProperties(this),Oie.#fc=this.createDrawerInstance(o,c,h,d,s),Oie.#gc=this.getDefaultDrawingOptions(),this._currentParent=e,({id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(Oie.#gc.toSVGProperties(),Oie.#fc.defaultSVGProperties),!0,!1)))}static _drawMove(e){if(Oie.#bc=-1,!Oie.#fc)return;const{offsetX:t,offsetY:n,pointerId:r}=e;Oie.#yc===r&&(Oie.#Ec?.size>=1?this._endDraw(e):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,Oie.#fc.add(t,n)),Oie.#bc=e.timeStamp,Sae(e)))}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,Oie.#fc=null,Oie.#gc=null,Oie.#Mc=null,Oie.#bc=NaN),Oie.#zc&&(Oie.#zc.abort(),Oie.#zc=null,Oie.#yc=NaN,Oie.#Ec=null)}static _endDraw(e){const t=this._currentParent;if(t)if(t.toggleDrawing(!0),this._cleanup(!1),e&&t.drawLayer.updateProperties(this._currentDrawId,Oie.#fc.end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const e=Oie.#fc,n=this._currentDrawId,r=e.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(n,e.setLastElement(r))},undo:()=>{t.drawLayer.updateProperties(n,e.removeLastElement())},mustExec:!1,type:Fre.DRAW_STEP})}else this.endDrawing(!1)}static endDrawing(e){const t=this._currentParent;if(!t)return null;if(t.toggleDrawing(!0),t.cleanUndoStack(Fre.DRAW_STEP),!Oie.#fc.isEmpty()){const{pageDimensions:[n,r],scale:a}=t,o=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Oie.#fc.getOutlines(n*a,r*a,a,this._INNER_MARGIN),drawingOptions:Oie.#gc,mustBeCommitted:!e});return this._cleanup(!0),o}return t.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,a,o){Kre("Not implemented")}static async deserialize(e,t,n){const{rawDims:{pageWidth:r,pageHeight:a,pageX:o,pageY:c}}=t.viewport,i=this.deserializeDraw(o,c,r,a,this._INNER_MARGIN,e),l=await super.deserialize(e,t,n);return l.createDrawingOptions(e),l.#Hc({drawOutlines:i}),l.#ec(),l.onScaleChanging(),l.rotate(),l}serializeDraw(e){const[t,n]=this.pageTranslation,[r,a]=this.pageDimensions;return this.#pc.serialize([t,n,r,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class Aie{#Ka=new Float64Array(6);#za;#Sc;#Rn;#to;#no;#xc="";#Tc=0;#Vo=new Rie;#Oc;#Ac;constructor(e,t,n,r,a,o){this.#Oc=n,this.#Ac=r,this.#Rn=a,this.#to=o,[e,t]=this.#Rc(e,t);const c=this.#za=[NaN,NaN,NaN,NaN,e,t];this.#no=[e,t],this.#Sc=[{line:c,points:this.#no}],this.#Ka.set(c,0)}updateProperty(e,t){"stroke-width"===e&&(this.#to=t)}#Rc(e,t){return bie._normalizePoint(e,t,this.#Oc,this.#Ac,this.#Rn)}isEmpty(){return!this.#Sc||0===this.#Sc.length}isCancellable(){return this.#no.length<=10}add(e,t){[e,t]=this.#Rc(e,t);const[n,r,a,o]=this.#Ka.subarray(2,6),c=e-a,i=t-o;return Math.hypot(this.#Oc*c,this.#Ac*i)<=2?null:(this.#no.push(e,t),isNaN(n)?(this.#Ka.set([a,o,e,t],2),this.#za.push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(this.#Ka[0])&&this.#za.splice(6,6),this.#Ka.set([n,r,a,o,e,t],0),this.#za.push(...bie.createBezierPoints(n,r,a,o,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){return this.add(e,t)||(2===this.#no.length?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,r,a){this.#Oc=n,this.#Ac=r,this.#Rn=a,[e,t]=this.#Rc(e,t);const o=this.#za=[NaN,NaN,NaN,NaN,e,t];this.#no=[e,t];const c=this.#Sc.at(-1);return c&&(c.line=new Float32Array(c.line),c.points=new Float32Array(c.points)),this.#Sc.push({line:o,points:this.#no}),this.#Ka.set(o,0),this.#Tc=0,this.toSVGPath(),null}getLastElement(){return this.#Sc.at(-1)}setLastElement(e){return this.#Sc?(this.#Sc.push(e),this.#za=e.line,this.#no=e.points,this.#Tc=0,{path:{d:this.toSVGPath()}}):this.#Vo.setLastElement(e)}removeLastElement(){if(!this.#Sc)return this.#Vo.removeLastElement();this.#Sc.pop(),this.#xc="";for(let e=0,t=this.#Sc.length;e<t;e++){const{line:t,points:n}=this.#Sc[e];this.#za=t,this.#no=n,this.#Tc=0,this.toSVGPath()}return{path:{d:this.#xc}}}toSVGPath(){const e=bie.svgRound(this.#za[4]),t=bie.svgRound(this.#za[5]);if(2===this.#no.length)return this.#xc=`${this.#xc} M ${e} ${t} Z`,this.#xc;if(this.#no.length<=6){const n=this.#xc.lastIndexOf("M");this.#xc=`${this.#xc.slice(0,n)} M ${e} ${t}`,this.#Tc=6}if(4===this.#no.length){const e=bie.svgRound(this.#za[10]),t=bie.svgRound(this.#za[11]);return this.#xc=`${this.#xc} L ${e} ${t}`,this.#Tc=12,this.#xc}const n=[];0===this.#Tc&&(n.push(`M ${e} ${t}`),this.#Tc=6);for(let e=this.#Tc,t=this.#za.length;e<t;e+=6){const[t,r,a,o,c,i]=this.#za.slice(e,e+6).map(bie.svgRound);n.push(`C${t} ${r} ${a} ${o} ${c} ${i}`)}return this.#xc+=n.join(" "),this.#Tc=this.#za.length,this.#xc}getOutlines(e,t,n,r){const a=this.#Sc.at(-1);return a.line=new Float32Array(a.line),a.points=new Float32Array(a.points),this.#Vo.build(this.#Sc,e,t,n,this.#Rn,this.#to,r),this.#Ka=null,this.#za=null,this.#Sc=null,this.#xc=null,this.#Vo}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class Rie extends bie{#mo;#Nc=0;#qa;#Sc;#Oc;#Ac;#_c;#Rn;#to;build(e,t,n,r,a,o,c){this.#Oc=t,this.#Ac=n,this.#_c=r,this.#Rn=a,this.#to=o,this.#qa=c??0,this.#Sc=e,this.#Dc()}setLastElement(e){return this.#Sc.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#Sc.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:t}of this.#Sc)if(e.push(`M${bie.svgRound(t[4])} ${bie.svgRound(t[5])}`),6!==t.length)if(12!==t.length)for(let n=6,r=t.length;n<r;n+=6){const[r,a,o,c,i,l]=t.subarray(n,n+6).map(bie.svgRound);e.push(`C${r} ${a} ${o} ${c} ${i} ${l}`)}else e.push(`L${bie.svgRound(t[10])} ${bie.svgRound(t[11])}`);else e.push("Z");return e.join("")}serialize([e,t,n,r],a){const o=[],c=[],[i,l,s,h]=this.#Pc();let d,u,m,p,v,f,z,g,y;switch(this.#Rn){case 0:y=bie._rescale,d=e,u=t+r,m=n,p=-r,v=e+i*n,f=t+(1-l-h)*r,z=e+(i+s)*n,g=t+(1-l)*r;break;case 90:y=bie._rescaleAndSwap,d=e,u=t,m=n,p=r,v=e+l*n,f=t+i*r,z=e+(l+h)*n,g=t+(i+s)*r;break;case 180:y=bie._rescale,d=e+n,u=t,m=-n,p=r,v=e+(1-i-s)*n,f=t+l*r,z=e+(1-i)*n,g=t+(l+h)*r;break;case 270:y=bie._rescaleAndSwap,d=e+n,u=t+r,m=-n,p=-r,v=e+(1-l-h)*n,f=t+(1-i-s)*r,z=e+(1-l)*n,g=t+(1-i)*r}for(const{line:e,points:t}of this.#Sc)o.push(y(e,d,u,m,p,a?new Array(e.length):null)),c.push(y(t,d,u,m,p,a?new Array(t.length):null));return{lines:o,points:c,rect:[v,f,z,g]}}static deserialize(e,t,n,r,a,{paths:{lines:o,points:c},rotation:i,thickness:l}){const s=[];let h,d,u,m,p;switch(i){case 0:p=bie._rescale,h=-e/n,d=t/r+1,u=1/n,m=-1/r;break;case 90:p=bie._rescaleAndSwap,h=-t/r,d=-e/n,u=1/r,m=1/n;break;case 180:p=bie._rescale,h=e/n+1,d=-t/r,u=-1/n,m=1/r;break;case 270:p=bie._rescaleAndSwap,h=t/r+1,d=e/n+1,u=-1/r,m=-1/n}if(!o){o=[];for(const e of c){const t=e.length;if(2===t){o.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(4===t){o.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}const n=new Float32Array(3*(t-2));o.push(n);let[r,a,c,i]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,a],0);for(let o=4;o<t;o+=2){const t=e[o],l=e[o+1];n.set(bie.createBezierPoints(r,a,c,i,t,l),3*(o-2)),[r,a,c,i]=[c,i,t,l]}}}for(let e=0,t=o.length;e<t;e++)s.push({line:p(o[e].map((e=>e??NaN)),h,d,u,m),points:p(c[e].map((e=>e??NaN)),h,d,u,m)});const v=new Rie;return v.build(s,n,r,1,i,l,a),v}#Fc(e=this.#to){const t=this.#qa+e/2*this.#_c;return this.#Rn%180==0?[t/this.#Oc,t/this.#Ac]:[t/this.#Ac,t/this.#Oc]}#Pc(){const[e,t,n,r]=this.#mo,[a,o]=this.#Fc(0);return[e+a,t+o,n-2*a,r-2*o]}#Dc(){const e=this.#mo=new Float32Array([1/0,1/0,-1/0,-1/0]);for(const{line:t}of this.#Sc){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6){const[r,a]=t.subarray(n,n+2);e[0]=Math.min(e[0],r),e[1]=Math.min(e[1],a),e[2]=Math.max(e[2],r),e[3]=Math.max(e[3],a)}continue}let n=t[4],r=t[5];for(let a=6,o=t.length;a<o;a+=6){const[o,c,i,l,s,h]=t.subarray(a,a+6);uae.bezierBoundingBox(n,r,o,c,i,l,s,h,e),n=s,r=h}}const[t,n]=this.#Fc();e[0]=Math.min(1,Math.max(0,e[0]-t)),e[1]=Math.min(1,Math.max(0,e[1]-n)),e[2]=Math.min(1,Math.max(0,e[2]+t)),e[3]=Math.min(1,Math.max(0,e[3]+n)),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#mo}updateProperty(e,t){return"stroke-width"===e?this.#rc(t):null}#rc(e){const[t,n]=this.#Fc();this.#to=e;const[r,a]=this.#Fc(),[o,c]=[r-t,a-n],i=this.#mo;return i[0]-=o,i[1]-=c,i[2]+=2*o,i[3]+=2*c,i}updateParentDimensions([e,t],n){const[r,a]=this.#Fc();this.#Oc=e,this.#Ac=t,this.#_c=n;const[o,c]=this.#Fc(),i=o-r,l=c-a,s=this.#mo;return s[0]-=i,s[1]-=l,s[2]+=2*i,s[3]+=2*l,s}updateRotation(e){return this.#Nc=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#mo.map(bie.svgRound).join(" ")}get defaultProperties(){const[e,t]=this.#mo;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`}}}get rotationTransform(){const[,,e,t]=this.#mo;let n=0,r=0,a=0,o=0,c=0,i=0;switch(this.#Nc){case 90:r=t/e,a=-e/t,c=e;break;case 180:n=-1,o=-1,c=e,i=t;break;case 270:r=-t/e,a=e/t,i=t;break;default:return""}return`matrix(${n} ${r} ${a} ${o} ${bie.svgRound(c)} ${bie.svgRound(i)})`}getPathResizingSVGProperties([e,t,n,r]){const[a,o]=this.#Fc(),[c,i,l,s]=this.#mo;if(Math.abs(l-a)<=bie.PRECISION||Math.abs(s-o)<=bie.PRECISION){const a=e+n/2-(c+l/2),o=t+r/2-(i+s/2);return{path:{"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`,transform:`${this.rotationTransform} translate(${a} ${o})`}}}const h=(n-2*a)/(l-2*a),d=(r-2*o)/(s-2*o),u=l/n,m=s/r;return{path:{"transform-origin":`${bie.svgRound(c)} ${bie.svgRound(i)}`,transform:`${this.rotationTransform} scale(${u} ${m}) translate(${bie.svgRound(a)} ${bie.svgRound(o)}) scale(${h} ${d}) translate(${bie.svgRound(-a)} ${bie.svgRound(-o)})`}}}getPathResizedSVGProperties([e,t,n,r]){const[a,o]=this.#Fc(),c=this.#mo,[i,l,s,h]=c;if(c[0]=e,c[1]=t,c[2]=n,c[3]=r,Math.abs(s-a)<=bie.PRECISION||Math.abs(h-o)<=bie.PRECISION){const a=e+n/2-(i+s/2),o=t+r/2-(l+h/2);for(const{line:e,points:t}of this.#Sc)bie._translate(e,a,o,e),bie._translate(t,a,o,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const d=(n-2*a)/(s-2*a),u=(r-2*o)/(h-2*o),m=-d*(i+a)+e+a,p=-u*(l+o)+t+o;if(1!==d||1!==u||0!==m||0!==p)for(const{line:e,points:t}of this.#Sc)bie._rescale(e,m,p,d,u,e),bie._rescale(t,m,p,d,u,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){const[r,a]=n,o=this.#mo,c=e-o[0],i=t-o[1];if(this.#Oc===r&&this.#Ac===a)for(const{line:e,points:t}of this.#Sc)bie._translate(e,c,i,e),bie._translate(t,c,i,t);else{const e=this.#Oc/r,t=this.#Ac/a;this.#Oc=r,this.#Ac=a;for(const{line:n,points:r}of this.#Sc)bie._rescale(n,c,i,e,t,n),bie._rescale(r,c,i,e,t,r);o[2]*=e,o[3]*=t}return o[0]=e,o[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`}}}get defaultSVGProperties(){const e=this.#mo;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${bie.svgRound(e[0])} ${bie.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}class Nie extends Tie{#Ic;constructor(e){super(),this.#Ic=e,super.updateProperties({fill:"none",stroke:Yae._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){"stroke-width"===e&&(t??=this["stroke-width"],t*=this.#Ic.realScale),super.updateSVGProperty(e,t)}clone(){const e=new Nie(this.#Ic);return e.updateAll(this),e}}class _ie extends Oie{static _type="ink";static _editorType=Pre.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"}),this._willKeepAspectRatio=!0}static initialize(e,t){Yae.initialize(e,t),this._defaultDrawingOptions=new Nie(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return Jre(this,"typesMap",new Map([[Fre.INK_THICKNESS,"stroke-width"],[Fre.INK_COLOR,"stroke"],[Fre.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,n,r,a){return new Aie(e,t,n,r,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,n,r,a,o){return Rie.deserialize(e,t,n,r,a,o)}static async deserialize(e,t,n){let r=null;if(e instanceof uie){const{data:{inkLists:t,rect:n,rotation:a,id:o,color:c,opacity:i,borderStyle:{rawWidth:l},popupRef:s},parent:{page:{pageNumber:h}}}=e;r=e={annotationType:Pre.INK,color:Array.from(c),thickness:l,opacity:i,paths:{points:t},boxes:null,pageIndex:h-1,rect:n.slice(0),rotation:a,id:o,deleted:!1,popupRef:s}}const a=await super.deserialize(e,t,n);return a.annotationElementId=e.id||null,a._initialData=r,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:t,opacity:n}){this._drawingOptions=_ie.getDefaultDrawingOptions({stroke:uae.makeHexColor(...e),"stroke-width":t,"stroke-opacity":n})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:t,points:n,rect:r}=this.serializeDraw(e),{_drawingOptions:{stroke:a,"stroke-opacity":o,"stroke-width":c}}=this,i={annotationType:Pre.INK,color:Yae._colorManager.convert(a),opacity:o,thickness:c,paths:{lines:t,points:n},pageIndex:this.pageIndex,rect:r,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?i:this.annotationElementId&&!this.#Ua(i)?null:(i.id=this.annotationElementId,i)}#Ua(e){const{color:t,thickness:n,opacity:r,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||e.color.some(((e,n)=>e!==t[n]))||e.thickness!==n||e.opacity!==r||e.pageIndex!==a}renderAnnotationElement(e){const{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:t}),null}}class Die extends Yae{#Bc=null;#jc=null;#Uc=null;#Wc=null;#$c=null;#qc="";#Gc=null;#Yc=null;#Kc=!1;#Xc=!1;static _type="stamp";static _editorType=Pre.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#Wc=e.bitmapUrl,this.#$c=e.bitmapFile}static initialize(e,t){Yae.initialize(e,t)}static get supportedTypes(){return Jre(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((e=>`image/${e}`)))}static get supportedTypesStr(){return Jre(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,t){t.pasteEditor(Pre.STAMP,{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#Qc(e,t=!1){e?(this.#Bc=e.bitmap,t||(this.#jc=e.id,this.#Kc=e.isSvg),e.file&&(this.#qc=e.file.name),this.#Jc()):this.remove()}#Zc(){if(this.#Uc=null,this._uiManager.enableWaiting(!1),this.#Gc){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Bc)return this._editToolbar.hide(),void this._uiManager.editAltText(this,!0);if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Bc){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:r,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,c=await n.guess({name:"altText",request:{data:r,width:a,height:o,channels:r.length/(a*o)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const i=c.output;return await this.setGuessedAltText(i),t&&!this.hasAltTextData()&&(this.altTextData={alt:i,decorative:!1}),i}#ei(){if(this.#jc)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#jc).then((e=>this.#Qc(e,!0))).finally((()=>this.#Zc()));if(this.#Wc){const e=this.#Wc;return this.#Wc=null,this._uiManager.enableWaiting(!0),void(this.#Uc=this._uiManager.imageManager.getFromUrl(e).then((e=>this.#Qc(e))).finally((()=>this.#Zc())))}if(this.#$c){const e=this.#$c;return this.#$c=null,this._uiManager.enableWaiting(!0),void(this.#Uc=this._uiManager.imageManager.getFromFile(e).then((e=>this.#Qc(e))).finally((()=>this.#Zc())))}const e=document.createElement("input");e.type="file",e.accept=Die.supportedTypesStr;const t=this._uiManager._signal;this.#Uc=new Promise((n=>{e.addEventListener("change",(async()=>{if(e.files&&0!==e.files.length){this._uiManager.enableWaiting(!0);const t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#Qc(t)}else this.remove();n()}),{signal:t}),e.addEventListener("cancel",(()=>{this.remove(),n()}),{signal:t})})).finally((()=>this.#Zc())),e.click()}remove(){this.#jc&&(this.#Bc=null,this._uiManager.imageManager.deleteId(this.#jc),this.#Gc?.remove(),this.#Gc=null,this.#Yc&&(clearTimeout(this.#Yc),this.#Yc=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#jc&&null===this.#Gc&&this.#ei(),this.isAttachedToDOM||this.parent.add(this))):this.#jc&&this.#ei()}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#Uc||this.#Bc||this.#Wc||this.#$c||this.#jc)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this.width&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),this.#Bc?this.#Jc():this.#ei(),this.width&&!this.annotationElementId){const[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r)}return this._uiManager.addShouldRescale(this),this.div}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(null!==this.#Yc&&clearTimeout(this.#Yc),this.#Yc=setTimeout((()=>{this.#Yc=null,this.#ti()}),200))}#Jc(){const{div:e}=this;let{width:t,height:n}=this.#Bc;const[r,a]=this.pageDimensions,o=.75;if(this.width)t=this.width*r,n=this.height*a;else if(t>o*r||n>o*a){const e=Math.min(o*r/t,o*a/n);t*=e,n*=e}const[c,i]=this.parentDimensions;this.setDims(t*c/r,n*i/a),this._uiManager.enableWaiting(!1);const l=this.#Gc=document.createElement("canvas");l.setAttribute("role","img"),this.addContainer(l),this.width=t/r,this.height=n/a,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),this.#ti(),this.#Xc||(this.parent.addUndoableEditor(this),this.#Xc=!0),this._reportTelemetry({action:"inserted_image"}),this.#qc&&l.setAttribute("aria-label",this.#qc)}copyCanvas(e,t,n=!1){e||(e=224);const{width:r,height:a}=this.#Bc,o=new _ae;let c=this.#Bc,i=r,l=a,s=null;if(t){if(r>t||a>t){const e=Math.min(t/r,t/a);i=Math.floor(r*e),l=Math.floor(a*e)}s=document.createElement("canvas");const e=s.width=Math.ceil(i*o.sx),n=s.height=Math.ceil(l*o.sy);this.#Kc||(c=this.#ni(e,n));const h=s.getContext("2d");h.filter=this._uiManager.hcmFilter;let d="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(d="#8f8f9d",u="#42414d");const m=15,p=m*o.sx,v=m*o.sy,f=new OffscreenCanvas(2*p,2*v),z=f.getContext("2d");z.fillStyle=d,z.fillRect(0,0,2*p,2*v),z.fillStyle=u,z.fillRect(0,0,p,v),z.fillRect(p,v,p,v),h.fillStyle=h.createPattern(f,"repeat"),h.fillRect(0,0,e,n),h.drawImage(c,0,0,c.width,c.height,0,0,e,n)}let h=null;if(n){let t,n;if(o.symmetric&&c.width<e&&c.height<e)t=c.width,n=c.height;else if(c=this.#Bc,r>e||a>e){const o=Math.min(e/r,e/a);t=Math.floor(r*o),n=Math.floor(a*o),this.#Kc||(c=this.#ni(t,n))}const i=new OffscreenCanvas(t,n).getContext("2d",{willReadFrequently:!0});i.drawImage(c,0,0,c.width,c.height,0,0,t,n),h={width:t,height:n,data:i.getImageData(0,0,t,n).data}}return{canvas:s,width:i,height:l,imageData:h}}#ni(e,t){const{width:n,height:r}=this.#Bc;let a=n,o=r,c=this.#Bc;for(;a>2*e||o>2*t;){const n=a,r=o;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*t&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const i=new OffscreenCanvas(a,o);i.getContext("2d").drawImage(c,0,0,n,r,0,0,a,o),c=i.transferToImageBitmap()}return c}#ti(){const[e,t]=this.parentDimensions,{width:n,height:r}=this,a=new _ae,o=Math.ceil(n*e*a.sx),c=Math.ceil(r*t*a.sy),i=this.#Gc;if(!i||i.width===o&&i.height===c)return;i.width=o,i.height=c;const l=this.#Kc?this.#Bc:this.#ni(o,c),s=i.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(l,0,0,l.width,l.height,0,0,o,c)}getImageForAltText(){return this.#Gc}#ri(e){if(e){if(this.#Kc){const e=this._uiManager.imageManager.getSvgUrl(this.#jc);if(e)return e}const e=document.createElement("canvas");return({width:e.width,height:e.height}=this.#Bc),e.getContext("2d").drawImage(this.#Bc,0,0),e.toDataURL()}if(this.#Kc){const[e,t]=this.pageDimensions,n=Math.round(this.width*e*gae.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*gae.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(n,r);return a.getContext("2d").drawImage(this.#Bc,0,0,this.#Bc.width,this.#Bc.height,0,0,n,r),a.transferToImageBitmap()}return structuredClone(this.#Bc)}static async deserialize(e,t,n){let r=null;if(e instanceof zie){const{data:{rect:a,rotation:o,id:c,structParent:i,popupRef:l},container:s,parent:{page:{pageNumber:h}}}=e,d=s.querySelector("canvas"),u=n.imageManager.getFromCanvas(s.id,d);d.remove();const m=(await t._structTree.getAriaAttributes(`${fae}${c}`))?.get("aria-label")||"";r=e={annotationType:Pre.STAMP,bitmapId:u.id,bitmap:u.bitmap,pageIndex:h-1,rect:a.slice(0),rotation:o,id:c,deleted:!1,accessibilityData:{decorative:!1,altText:m},isSvg:!1,structParent:i,popupRef:l}}const a=await super.deserialize(e,t,n),{rect:o,bitmap:c,bitmapUrl:i,bitmapId:l,isSvg:s,accessibilityData:h}=e;l&&n.imageManager.isValidId(l)?(a.#jc=l,c&&(a.#Bc=c)):a.#Wc=i,a.#Kc=s;const[d,u]=a.pageDimensions;return a.width=(o[2]-o[0])/d,a.height=(o[3]-o[1])/u,a.annotationElementId=e.id||null,h&&(a.altTextData=h),a._initialData=r,a.#Xc=!!r,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n={annotationType:Pre.STAMP,bitmapId:this.#jc,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#Kc,structTreeParentId:this._structTreeParentId};if(e)return n.bitmapUrl=this.#ri(!0),n.accessibilityData=this.serializeAltText(!0),n;const{decorative:r,altText:a}=this.serializeAltText(!1);if(!r&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const e=this.#Ua(n);if(e.isSame)return null;e.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1}if(n.id=this.annotationElementId,null===t)return n;t.stamps||=new Map;const o=this.#Kc?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(t.stamps.has(this.#jc)){if(this.#Kc){const e=t.stamps.get(this.#jc);o>e.area&&(e.area=o,e.serialized.bitmap.close(),e.serialized.bitmap=this.#ri(!1))}}else t.stamps.set(this.#jc,{area:o,serialized:n}),n.bitmap=this.#ri(!1);return n}#Ua(e){const{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===t,a=(e.accessibilityData?.alt||"")===n;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&r&&a,isSameAltText:a}}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}}class Pie{#La;#ai=!1;#oi=null;#ci=null;#ii=null;#li=new Map;#si=!1;#hi=!1;#di=!1;#ui=null;#mi=null;#pi=null;#vi=null;#v;static _initialized=!1;static#B=new Map([Eie,_ie,Die,xie].map((e=>[e._editorType,e])));constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:r,accessibilityManager:a,annotationLayer:o,drawLayer:c,textLayer:i,viewport:l,l10n:s}){const h=[...Pie.#B.values()];if(!Pie._initialized){Pie._initialized=!0;for(const t of h)t.initialize(s,e)}e.registerEditorTypes(h),this.#v=e,this.pageIndex=t,this.div=n,this.#La=a,this.#oi=o,this.viewport=l,this.#pi=i,this.drawLayer=c,this._structTree=r,this.#v.addLayer(this)}get isEmpty(){return 0===this.#li.size}get isInvisible(){return this.isEmpty&&this.#v.getMode()===Pre.NONE}updateToolbar(e){this.#v.updateToolbar(e)}updateMode(e=this.#v.getMode()){switch(this.#fi(),e){case Pre.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case Pre.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Pre.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const n of Pie.#B.values())t.toggle(`${n._type}Editing`,e===n._editorType);this.div.hidden=!1}hasTextLayer(e){return e===this.#pi?.div}setEditingState(e){this.#v.setEditingState(e)}addCommands(e){this.#v.addCommands(e)}cleanUndoStack(e){this.#v.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#oi?.div.classList.toggle("disabled",!e)}async enable(){this.#di=!0,this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const t of this.#li.values())t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#v.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));if(!this.#oi)return void(this.#di=!1);const t=this.#oi.getEditableAnnotations();for(const n of t){if(n.hide(),this.#v.isDeletedAnnotationElement(n.data.id))continue;if(e.has(n.data.id))continue;const t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}this.#di=!1}disable(){this.#hi=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const n of this.#li.values())n.disableEditing(),n.annotationElementId&&(null===n.serialize()?(t.set(n.annotationElementId,n),this.getEditableAnnotation(n.annotationElementId)?.show(),n.remove()):e.set(n.annotationElementId,n));if(this.#oi){const n=this.#oi.getEditableAnnotations();for(const r of n){const{id:n}=r.data;if(this.#v.isDeletedAnnotationElement(n))continue;let a=t.get(n);a?(a.resetAnnotationElement(r),a.show(!1),r.show()):(a=e.get(n),a&&(this.#v.addChangedExistingAnnotation(a),a.renderAnnotationElement(r)&&a.show(!1)),r.show())}}this.#fi(),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const e of Pie.#B.values())n.remove(`${e._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#hi=!1}getEditableAnnotation(e){return this.#oi?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#v.getActive()!==e&&this.#v.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#pi?.div&&!this.#vi){this.#vi=new AbortController;const e=this.#v.combinedSignal(this.#vi);this.#pi.div.addEventListener("pointerdown",this.#zi.bind(this),{signal:e}),this.#pi.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#pi?.div&&this.#vi&&(this.#vi.abort(),this.#vi=null,this.#pi.div.classList.remove("highlighting"))}#zi(e){this.#v.unselectAll();const{target:t}=e;if(t===this.#pi.div||("img"===t.getAttribute("role")||t.classList.contains("endOfContent"))&&this.#pi.div.contains(t)){const{isMac:t}=hae.platform;if(0!==e.button||e.ctrlKey&&t)return;this.#v.showAllEditors("highlight",!0,!0),this.#pi.div.classList.add("free"),this.toggleDrawing(),xie.startHighlighting(this,"ltr"===this.#v.direction,{target:this.#pi.div,x:e.x,y:e.y}),this.#pi.div.addEventListener("pointerup",(()=>{this.#pi.div.classList.remove("free"),this.toggleDrawing(!0)}),{once:!0,signal:this.#v._signal}),e.preventDefault()}}enableClick(){if(this.#ci)return;this.#ci=new AbortController;const e=this.#v.combinedSignal(this.#ci);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){this.#ci?.abort(),this.#ci=null}attach(e){this.#li.set(e.id,e);const{annotationElementId:t}=e;t&&this.#v.isDeletedAnnotationElement(t)&&this.#v.removeDeletedAnnotationElement(e)}detach(e){this.#li.delete(e.id),this.#La?.removePointerInTextLayer(e.contentDiv),!this.#hi&&e.annotationElementId&&this.#v.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#v.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#v.addDeletedAnnotationElement(e.annotationElementId),Yae.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(e.parent!==this||!e.isAttachedToDOM){if(this.changeParent(e),this.#v.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#di),this.#v.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!this.#ii&&(e._focusEventsAllowed=!1,this.#ii=setTimeout((()=>{this.#ii=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this.#v._signal}),t.focus())}),0)),e._structTreeParentId=this.#La?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#v.getId()}get#gi(){return Pie.#B.get(this.#v.getMode())}combinedSignal(e){return this.#v.combinedSignal(e)}#yi(e){const t=this.#gi;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#gi?.canCreateNewEmptyEditor()}pasteEditor(e,t){this.#v.updateToolbar(e),this.#v.updateMode(e);const{offsetX:n,offsetY:r}=this.#Mi(),a=this.getNextId(),o=this.#yi({parent:this,id:a,x:n,y:r,uiManager:this.#v,isCentered:!0,...t});o&&this.add(o)}async deserialize(e){return await(Pie.#B.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#v))||null}createAndAddNewEditor(e,t,n={}){const r=this.getNextId(),a=this.#yi({parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:this.#v,isCentered:t,...n});return a&&this.add(a),a}#Mi(){const{x:e,y:t,width:n,height:r}=this.div.getBoundingClientRect(),a=Math.max(0,e),o=Math.max(0,t),c=(a+Math.min(window.innerWidth,e+n))/2-e,i=(o+Math.min(window.innerHeight,t+r))/2-t,[l,s]=this.viewport.rotation%180==0?[c,i]:[i,c];return{offsetX:l,offsetY:s}}addNewEditor(){this.createAndAddNewEditor(this.#Mi(),!0)}setSelected(e){this.#v.setSelected(e)}toggleSelected(e){this.#v.toggleSelected(e)}unselect(e){this.#v.unselect(e)}pointerup(e){const{isMac:t}=hae.platform;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#si&&(this.#si=!1,this.#gi?.isDrawer&&this.#gi.supportMultipleDrawings||(this.#ai?this.#v.getMode()!==Pre.STAMP?this.createAndAddNewEditor(e,!1):this.#v.unselectAll():this.#ai=!0))}pointerdown(e){if(this.#v.getMode()===Pre.HIGHLIGHT&&this.enableTextSelection(),this.#si)return void(this.#si=!1);const{isMac:t}=hae.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;if(this.#si=!0,this.#gi?.isDrawer)return void this.startDrawingSession(e);const n=this.#v.getActive();this.#ai=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus(),this.#ui)return void this.#gi.startDrawing(this,this.#v,!1,e);this.#v.setCurrentDrawingSession(this),this.#ui=new AbortController;const t=this.#v.combinedSignal(this.#ui);this.div.addEventListener("blur",(({relatedTarget:e})=>{e&&!this.div.contains(e)&&(this.#mi=null,this.commitOrRemove())}),{signal:t}),this.#gi.startDrawing(this,this.#v,!1,e)}pause(e){if(e){const{activeElement:e}=document;this.div.contains(e)&&(this.#mi=e)}else this.#mi&&setTimeout((()=>{this.#mi?.focus(),this.#mi=null}),0)}endDrawingSession(e=!1){return this.#ui?(this.#v.setCurrentDrawingSession(null),this.#ui.abort(),this.#ui=null,this.#mi=null,this.#gi.endDrawing(e)):null}findNewParent(e,t,n){const r=this.#v.findParent(t,n);return null!==r&&r!==this&&(r.changeParent(e),!0)}commitOrRemove(){return!!this.#ui&&(this.endDrawingSession(),!0)}onScaleChanging(){this.#ui&&this.#gi.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#v.getActive()?.parent===this&&(this.#v.commitOrRemove(),this.#v.setActiveEditor(null)),this.#ii&&(clearTimeout(this.#ii),this.#ii=null);for(const e of this.#li.values())this.#La?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#li.clear(),this.#v.removeLayer(this)}#fi(){for(const e of this.#li.values())e.isEmpty()&&e.remove()}render({viewport:e}){this.viewport=e,Nae(this.div,e);for(const e of this.#v.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:e}){this.#v.commitOrRemove(),this.#fi();const t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,Nae(this.div,{rotation:n}),t!==n)for(const e of this.#li.values())e.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#v.viewParameters.realScale}}class Fie{#aa=null;#y=0;#Ei=new Map;#bi=new Map;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(this.#aa){if(this.#aa!==e){if(this.#Ei.size>0)for(const t of this.#Ei.values())t.remove(),e.append(t);this.#aa=e}}else this.#aa=e}static get _svgFactory(){return Jre(this,"_svgFactory",new Bce)}static#Hi(e,[t,n,r,a]){const{style:o}=e;o.top=100*n+"%",o.left=100*t+"%",o.width=100*r+"%",o.height=100*a+"%"}#Vi(){const e=Fie._svgFactory.create(1,1,!0);return this.#aa.append(e),e.setAttribute("aria-hidden",!0),e}#Ci(e,t){const n=Fie._svgFactory.createElement("clipPath");e.append(n);const r=`clip_${t}`;n.setAttribute("id",r),n.setAttribute("clipPathUnits","objectBoundingBox");const a=Fie._svgFactory.createElement("use");return n.append(a),a.setAttribute("href",`#${t}`),a.classList.add("clip"),r}#Li(e,t){for(const[n,r]of Object.entries(t))null===r?e.removeAttribute(n):e.setAttribute(n,r)}draw(e,t=!1,n=!1){const r=this.#y++,a=this.#Vi(),o=Fie._svgFactory.createElement("defs");a.append(o);const c=Fie._svgFactory.createElement("path");o.append(c);const i=`path_p${this.pageIndex}_${r}`;c.setAttribute("id",i),c.setAttribute("vector-effect","non-scaling-stroke"),t&&this.#bi.set(r,c);const l=n?this.#Ci(o,i):null,s=Fie._svgFactory.createElement("use");return a.append(s),s.setAttribute("href",`#${i}`),this.updateProperties(a,e),this.#Ei.set(r,a),{id:r,clipPathId:`url(#${l})`}}drawOutline(e,t){const n=this.#y++,r=this.#Vi(),a=Fie._svgFactory.createElement("defs");r.append(a);const o=Fie._svgFactory.createElement("path");a.append(o);const c=`path_p${this.pageIndex}_${n}`;let i;if(o.setAttribute("id",c),o.setAttribute("vector-effect","non-scaling-stroke"),t){const e=Fie._svgFactory.createElement("mask");a.append(e),i=`mask_p${this.pageIndex}_${n}`,e.setAttribute("id",i),e.setAttribute("maskUnits","objectBoundingBox");const t=Fie._svgFactory.createElement("rect");e.append(t),t.setAttribute("width","1"),t.setAttribute("height","1"),t.setAttribute("fill","white");const r=Fie._svgFactory.createElement("use");e.append(r),r.setAttribute("href",`#${c}`),r.setAttribute("stroke","none"),r.setAttribute("fill","black"),r.setAttribute("fill-rule","nonzero"),r.classList.add("mask")}const l=Fie._svgFactory.createElement("use");r.append(l),l.setAttribute("href",`#${c}`),i&&l.setAttribute("mask",`url(#${i})`);const s=l.cloneNode();return r.append(s),l.classList.add("mainOutline"),s.classList.add("secondaryOutline"),this.updateProperties(r,e),this.#Ei.set(n,r),n}finalizeDraw(e,t){this.#bi.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;const{root:n,bbox:r,rootClass:a,path:o}=t,c="number"==typeof e?this.#Ei.get(e):e;if(c){if(n&&this.#Li(c,n),r&&Fie.#Hi(c,r),a){const{classList:e}=c;for(const[t,n]of Object.entries(a))e.toggle(t,n)}if(o){const e=c.firstChild.firstChild;this.#Li(e,o)}}}updateParent(e,t){if(t===this)return;const n=this.#Ei.get(e);n&&(t.#aa.append(n),this.#Ei.delete(e),t.#Ei.set(e,n))}remove(e){this.#bi.delete(e),null!==this.#aa&&(this.#Ei.get(e).remove(),this.#Ei.delete(e))}destroy(){this.#aa=null;for(const e of this.#Ei.values())e.remove();this.#Ei.clear(),this.#bi.clear()}}globalThis.pdfjsTestingUtils={HighlightOutliner:Cie};var Iie=Ore.GlobalWorkerOptions,Bie=Ore.TextLayer,jie=Ore.getDocument;function Uie(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===n&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}Uie('.messageBar{--closing-button-icon:url(images/messageBar_closingButton.svg);--message-bar-close-button-color:var(--text-primary-color);--message-bar-close-button-color-hover:var(--text-primary-color);--message-bar-close-button-border-radius:4px;--message-bar-close-button-border:none;--message-bar-close-button-hover-bg-color:#15141a24;--message-bar-close-button-active-bg-color:#15141a36;--message-bar-close-button-focus-bg-color:#15141a12}@media (prefers-color-scheme:dark){.messageBar{--message-bar-close-button-hover-bg-color:#fbfbfe24;--message-bar-close-button-active-bg-color:#fbfbfe36;--message-bar-close-button-focus-bg-color:#fbfbfe12}}@media screen and (forced-colors:active){.messageBar{--message-bar-close-button-color:ButtonText;--message-bar-close-button-border:1px solid ButtonText;--message-bar-close-button-hover-bg-color:ButtonText;--message-bar-close-button-active-bg-color:ButtonText;--message-bar-close-button-focus-bg-color:ButtonText;--message-bar-close-button-color-hover:HighlightText}}.messageBar{align-items:center;background:var(--message-bar-bg-color);border:1px solid var(--message-bar-border-color);border-radius:4px;color:var(--message-bar-fg-color);display:flex;flex-direction:column;gap:8px;justify-content:center;padding:8px 8px 8px 16px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.messageBar>div{align-items:flex-start;align-self:stretch;display:flex;gap:8px}:is(.messageBar>div):before{background-color:var(--message-bar-icon-color);content:"";display:inline-block;flex-shrink:0;height:16px;-webkit-mask-image:var(--message-bar-icon);mask-image:var(--message-bar-icon);-webkit-mask-size:cover;mask-size:cover;width:16px}.messageBar button{cursor:pointer}:is(.messageBar button):focus-visible{outline:var(--focus-ring-outline);outline-offset:2px}.messageBar .closeButton{align-items:center;background:none;border:var(--message-bar-close-button-border);border-radius:var(--message-bar-close-button-border-radius);display:flex;height:32px;justify-content:center;width:32px}:is(.messageBar .closeButton):before{background-color:var(--message-bar-close-button-color);content:"";display:inline-block;height:16px;-webkit-mask-image:var(--closing-button-icon);mask-image:var(--closing-button-icon);-webkit-mask-size:cover;mask-size:cover;width:16px}:is(.messageBar .closeButton):is(:hover,:active,:focus):before{background-color:var(--message-bar-close-button-color-hover)}:is(.messageBar .closeButton):hover{background-color:var(--message-bar-close-button-hover-bg-color)}:is(.messageBar .closeButton):active{background-color:var(--message-bar-close-button-active-bg-color)}:is(.messageBar .closeButton):focus{background-color:var(--message-bar-close-button-focus-bg-color)}:is(.messageBar .closeButton)>span{display:inline-block;height:0;overflow:hidden;width:0}#editorUndoBar{--text-primary-color:#15141a;--message-bar-icon:url(images/secondaryToolbarButton-documentProperties.svg);--message-bar-icon-color:#0060df;--message-bar-bg-color:#deeafc;--message-bar-fg-color:var(--text-primary-color);--message-bar-border-color:#00000014;--undo-button-bg-color:#15141a12;--undo-button-bg-color-hover:#15141a24;--undo-button-bg-color-active:#15141a36;--undo-button-fg-color:var(--message-bar-fg-color);--undo-button-fg-color-hover:var(--undo-button-fg-color);--undo-button-fg-color-active:var(--undo-button-fg-color);--focus-ring-color:#0060df;--focus-ring-outline:2px solid var(--focus-ring-color)}@media (prefers-color-scheme:dark){#editorUndoBar{--text-primary-color:#fbfbfe;--message-bar-icon-color:#73a7f3;--message-bar-bg-color:#003070;--message-bar-border-color:#ffffff14;--undo-button-bg-color:#ffffff14;--undo-button-bg-color-hover:#ffffff24;--undo-button-bg-color-active:#ffffff36}}@media screen and (forced-colors:active){#editorUndoBar{--text-primary-color:CanvasText;--message-bar-icon-color:CanvasText;--message-bar-bg-color:Canvas;--message-bar-border-color:CanvasText;--undo-button-bg-color:ButtonText;--undo-button-bg-color-hover:SelectedItem;--undo-button-bg-color-active:SelectedItem;--undo-button-fg-color:ButtonFace;--undo-button-fg-color-hover:SelectedItemText;--undo-button-fg-color-active:SelectedItemText;--focus-ring-color:CanvasText}}#editorUndoBar{cursor:default;font:menu;font-size:15px;left:50%;padding-block:8px;padding-inline:16px 8px;position:fixed;top:50px;transform:translateX(-50%);z-index:10}#editorUndoBar button{cursor:pointer}#editorUndoBar #editorUndoBarUndoButton{background-color:var(--undo-button-bg-color);border:none;border-radius:4px;color:var(--undo-button-fg-color);font-weight:590;height:32px;line-height:19.5px;margin-inline-start:8px;padding:4px 16px}:is(#editorUndoBar #editorUndoBarUndoButton):hover{background-color:var(--undo-button-bg-color-hover);color:var(--undo-button-fg-color-hover)}:is(#editorUndoBar #editorUndoBarUndoButton):active{background-color:var(--undo-button-bg-color-active);color:var(--undo-button-fg-color-active)}#editorUndoBar>div{align-items:center}.dialog{--dialog-bg-color:#fff;--dialog-border-color:#fff;--dialog-shadow:0 2px 14px 0 #3a394433;--text-primary-color:#15141a;--text-secondary-color:#5b5b66;--hover-filter:brightness(0.9);--focus-ring-color:#0060df;--focus-ring-outline:2px solid var(--focus-ring-color);--link-fg-color:#0060df;--link-hover-fg-color:#0250bb;--separator-color:#f0f0f4;--textarea-border-color:#8f8f9d;--textarea-bg-color:#fff;--textarea-fg-color:var(--text-secondary-color);--radio-bg-color:#f0f0f4;--radio-checked-bg-color:#fbfbfe;--radio-border-color:#8f8f9d;--radio-checked-border-color:#0060df;--button-secondary-bg-color:#f0f0f4;--button-secondary-fg-color:var(--text-primary-color);--button-secondary-border-color:var(--button-secondary-bg-color);--button-secondary-hover-bg-color:var(--button-secondary-bg-color);--button-secondary-hover-fg-color:var(--button-secondary-fg-color);--button-secondary-hover-border-color:var(--button-secondary-hover-bg-color);--button-primary-bg-color:#0060df;--button-primary-fg-color:#fbfbfe;--button-primary-border-color:var(--button-primary-bg-color);--button-primary-hover-bg-color:var(--button-primary-bg-color);--button-primary-hover-fg-color:var(--button-primary-fg-color);--button-primary-hover-border-color:var(--button-primary-hover-bg-color)}@media (prefers-color-scheme:dark){.dialog{--dialog-bg-color:#1c1b22;--dialog-border-color:#1c1b22;--dialog-shadow:0 2px 14px 0 #15141a;--text-primary-color:#fbfbfe;--text-secondary-color:#cfcfd8;--focus-ring-color:#0df;--hover-filter:brightness(1.4);--link-fg-color:#0df;--link-hover-fg-color:#80ebff;--separator-color:#52525e;--textarea-bg-color:#42414d;--radio-bg-color:#2b2a33;--radio-checked-bg-color:#15141a;--radio-checked-border-color:#0df;--button-secondary-bg-color:#2b2a33;--button-primary-bg-color:#0df;--button-primary-fg-color:#15141a}}@media screen and (forced-colors:active){.dialog{--dialog-bg-color:Canvas;--dialog-border-color:CanvasText;--dialog-shadow:none;--text-primary-color:CanvasText;--text-secondary-color:CanvasText;--hover-filter:none;--focus-ring-color:ButtonBorder;--link-fg-color:LinkText;--link-hover-fg-color:LinkText;--separator-color:CanvasText;--textarea-border-color:ButtonBorder;--textarea-bg-color:Field;--textarea-fg-color:ButtonText;--radio-bg-color:ButtonFace;--radio-checked-bg-color:ButtonFace;--radio-border-color:ButtonText;--radio-checked-border-color:ButtonText;--button-secondary-bg-color:ButtonFace;--button-secondary-fg-color:ButtonText;--button-secondary-border-color:ButtonText;--button-secondary-hover-bg-color:AccentColor;--button-secondary-hover-fg-color:AccentColorText;--button-primary-bg-color:ButtonText;--button-primary-fg-color:ButtonFace;--button-primary-hover-bg-color:AccentColor;--button-primary-hover-fg-color:AccentColorText}}.dialog{background:var(--dialog-bg-color);border:1px solid var(--dialog-border-color);border-radius:4px;box-shadow:var(--dialog-shadow);color:var(--text-primary-color);font:message-box;font-size:13px;font-weight:400;line-height:150%;padding:12px 16px}:is(.dialog .mainContainer) :focus-visible{outline:var(--focus-ring-outline);outline-offset:2px}:is(.dialog .mainContainer) .title{align-items:flex-start;display:flex;flex-direction:column;gap:12px;justify-content:flex-end;width:auto}:is(:is(.dialog .mainContainer) .title)>span{font-size:13px;font-style:normal;font-weight:590;line-height:150%}:is(.dialog .mainContainer) .dialogSeparator{border-bottom:none;border-top:1px solid var(--separator-color);height:0;margin-block:4px;width:100%}:is(.dialog .mainContainer) .dialogButtonsGroup{align-self:flex-end;display:flex;gap:12px}:is(.dialog .mainContainer) .radio{align-items:flex-start;display:flex;flex-direction:column;gap:4px}:is(:is(.dialog .mainContainer) .radio)>.radioButton{align-items:center;align-self:stretch;display:flex;gap:8px}:is(:is(:is(.dialog .mainContainer) .radio)>.radioButton) input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--radio-bg-color);border:1px solid var(--radio-border-color);border-radius:50%;box-sizing:border-box;height:16px;width:16px}:is(:is(:is(:is(.dialog .mainContainer) .radio)>.radioButton) input):hover{filter:var(--hover-filter)}:is(:is(:is(:is(.dialog .mainContainer) .radio)>.radioButton) input):checked{background-color:var(--radio-checked-bg-color);border:4px solid var(--radio-checked-border-color)}:is(:is(.dialog .mainContainer) .radio)>.radioLabel{align-items:flex-start;align-self:stretch;display:flex;gap:10px;padding-inline-start:24px}:is(:is(:is(.dialog .mainContainer) .radio)>.radioLabel)>span{color:var(--text-secondary-color);flex:1 0 0;font-size:11px}:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton)){border:1px solid;border-radius:4px;font:menu;font-weight:600;height:32px;padding:4px 16px;width:auto}:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{cursor:pointer;filter:var(--hover-filter)}.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))){background-color:var(--button-secondary-bg-color);border-color:var(--button-secondary-border-color);color:var(--button-secondary-fg-color)}.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{background-color:var(--button-secondary-hover-bg-color);border-color:var(--button-secondary-hover-border-color);color:var(--button-secondary-hover-fg-color)}.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))){background-color:var(--button-primary-bg-color);border-color:var(--button-primary-border-color);color:var(--button-primary-fg-color);opacity:1}.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{background-color:var(--button-primary-hover-bg-color);border-color:var(--button-primary-hover-border-color);color:var(--button-primary-hover-fg-color)}:is(.dialog .mainContainer) a{color:var(--link-fg-color)}:is(:is(.dialog .mainContainer) a):hover{color:var(--link-hover-fg-color)}:is(.dialog .mainContainer) textarea{background:var(--textarea-bg-color);border:1px solid var(--textarea-border-color);border-radius:4px;box-sizing:border-box;color:var(--textarea-fg-color);font:inherit;margin:0;padding:8px;resize:none}:is(:is(.dialog .mainContainer) textarea):focus{border-color:#0000;outline-offset:0}:is(:is(.dialog .mainContainer) textarea):disabled{opacity:.4;pointer-events:none}:is(.dialog .mainContainer) .messageBar{--message-bar-bg-color:#ffebcd;--message-bar-fg-color:#15141a;--message-bar-border-color:#00000014;--message-bar-icon:url(images/messageBar_warning.svg);--message-bar-icon-color:#cd411e}@media (prefers-color-scheme:dark){:is(.dialog .mainContainer) .messageBar{--message-bar-bg-color:#5a3100;--message-bar-fg-color:#fbfbfe;--message-bar-border-color:#ffffff14;--message-bar-icon-color:#e49c49}}@media screen and (forced-colors:active){:is(.dialog .mainContainer) .messageBar{--message-bar-bg-color:HighlightText;--message-bar-fg-color:CanvasText;--message-bar-border-color:CanvasText;--message-bar-icon-color:CanvasText}}:is(.dialog .mainContainer) .messageBar{align-self:stretch}:is(:is(:is(.dialog .mainContainer) .messageBar)>div):before,:is(:is(:is(.dialog .mainContainer) .messageBar)>div)>div{margin-block:4px}:is(:is(:is(.dialog .mainContainer) .messageBar)>div)>div{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;gap:8px}:is(:is(:is(:is(.dialog .mainContainer) .messageBar)>div)>div) .title{font-size:13px;font-weight:590}:is(:is(:is(:is(.dialog .mainContainer) .messageBar)>div)>div) .description{font-size:13px}:is(.dialog .mainContainer) .toggler{align-items:center;align-self:stretch;display:flex;gap:8px}:is(:is(.dialog .mainContainer) .toggler)>.togglerLabel{-webkit-user-select:none;-moz-user-select:none;user-select:none}.textLayer{-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;caret-color:CanvasText;forced-color-adjust:none;inset:0;line-height:1;opacity:1;overflow:clip;position:absolute;text-align:initial;transform-origin:0 0;z-index:0}.textLayer.highlighting{touch-action:none}.textLayer :is(span,br){color:#0000;cursor:text;position:absolute;transform-origin:0 0;white-space:pre}.textLayer .markedContent span:not(.markedContent),.textLayer>:not(.markedContent){z-index:1}.textLayer span.markedContent{height:0;top:0}.textLayer span[role=img]{cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textLayer .highlight{--highlight-bg-color:#b400aa40;--highlight-selected-bg-color:#00640040;--highlight-backdrop-filter:none;--highlight-selected-backdrop-filter:none}@media screen and (forced-colors:active){.textLayer .highlight{--highlight-bg-color:#0000;--highlight-selected-bg-color:#0000;--highlight-backdrop-filter:var(--hcm-highlight-filter);--highlight-selected-backdrop-filter:var(\n --hcm-highlight-selected-filter\n )}}.textLayer .highlight{-webkit-backdrop-filter:var(--highlight-backdrop-filter);backdrop-filter:var(--highlight-backdrop-filter);background-color:var(--highlight-bg-color);border-radius:4px;margin:-1px;padding:1px}.appended:is(.textLayer .highlight){position:static}.begin:is(.textLayer .highlight){border-radius:4px 0 0 4px}.end:is(.textLayer .highlight){border-radius:0 4px 4px 0}.middle:is(.textLayer .highlight){border-radius:0}.selected:is(.textLayer .highlight){-webkit-backdrop-filter:var(--highlight-selected-backdrop-filter);backdrop-filter:var(--highlight-selected-backdrop-filter);background-color:var(--highlight-selected-bg-color)}.textLayer ::-moz-selection{background:#0000ff40;background:color-mix(in srgb,AccentColor,#0000 75%)}.textLayer ::selection{background:#0000ff40;background:color-mix(in srgb,AccentColor,#0000 75%)}.textLayer br::-moz-selection{background:#0000}.textLayer br::selection{background:#0000}.textLayer .endOfContent{cursor:default;display:block;inset:100% 0 0;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:0}.textLayer.selecting .endOfContent{top:0}.annotationLayer{--annotation-unfocused-field-background:url(\'data:image/svg+xml;charset=utf-8,<svg width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" style="fill:rgba(0,54,255,.13)"/></svg>\');--input-focus-border-color:Highlight;--input-focus-outline:1px solid Canvas;--input-unfocused-border-color:#0000;--input-disabled-border-color:#0000;--input-hover-border-color:#000;--link-outline:none}@media screen and (forced-colors:active){.annotationLayer{--input-focus-border-color:CanvasText;--input-unfocused-border-color:ActiveText;--input-disabled-border-color:GrayText;--input-hover-border-color:Highlight;--link-outline:1.5px solid LinkText}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .textWidgetAnnotation :is(input,textarea):required{outline:1.5px solid selectedItem}.annotationLayer .linkAnnotation{outline:var(--link-outline)}:is(.annotationLayer .linkAnnotation):hover{-webkit-backdrop-filter:var(--hcm-highlight-filter);backdrop-filter:var(--hcm-highlight-filter)}:is(.annotationLayer .linkAnnotation)>a:hover{background:none!important;box-shadow:none;opacity:0!important}.annotationLayer .popupAnnotation .popup{background-color:ButtonFace!important;color:ButtonText!important;outline:calc(1.5px*var(--scale-factor)) solid CanvasText!important}.annotationLayer .highlightArea:hover:after{-webkit-backdrop-filter:var(--hcm-highlight-filter);backdrop-filter:var(--hcm-highlight-filter);content:"";height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.annotationLayer .popupAnnotation.focused .popup{outline:calc(3px*var(--scale-factor)) solid Highlight!important}}.annotationLayer{left:0;pointer-events:none;position:absolute;top:0;transform-origin:0 0}.annotationLayer[data-main-rotation="90"] .norotate{transform:rotate(270deg) translateX(-100%)}.annotationLayer[data-main-rotation="180"] .norotate{transform:rotate(180deg) translate(-100%,-100%)}.annotationLayer[data-main-rotation="270"] .norotate{transform:rotate(90deg) translateY(-100%)}.annotationLayer.disabled .popup,.annotationLayer.disabled section{pointer-events:none}.annotationLayer .annotationContent{height:100%;pointer-events:none;position:absolute;width:100%}.freetext:is(.annotationLayer .annotationContent){background:#0000;border:none;font:10px sans-serif;inset:0;line-height:1.35;overflow:visible;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.annotationLayer section{box-sizing:border-box;pointer-events:auto;position:absolute;text-align:initial;transform-origin:0 0}:is(.annotationLayer section):has(div.annotationContent) canvas.annotationContent{display:none}.textLayer.selecting~.annotationLayer section{pointer-events:none}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton)>a{font-size:1em;height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton):not(.hasBorder)>a:hover{background-color:#ff0;box-shadow:0 2px 10px #ff0;opacity:.2}.annotationLayer .linkAnnotation.hasBorder:hover{background-color:#ff03}.annotationLayer .hasBorder{background-size:100% 100%}.annotationLayer .textAnnotation img{cursor:pointer;height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input,.annotationLayer .choiceWidgetAnnotation select,.annotationLayer .textWidgetAnnotation :is(input,textarea){background-image:var(--annotation-unfocused-field-background);border:2px solid var(--input-unfocused-border-color);box-sizing:border-box;font:calc(9px*var(--scale-factor)) sans-serif;height:100%;margin:0;vertical-align:top;width:100%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .textWidgetAnnotation :is(input,textarea):required{outline:1.5px solid red}.annotationLayer .choiceWidgetAnnotation select option{padding:0}.annotationLayer .buttonWidgetAnnotation.radioButton input{border-radius:50%}.annotationLayer .textWidgetAnnotation textarea{resize:none}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input[disabled],.annotationLayer .choiceWidgetAnnotation select[disabled],.annotationLayer .textWidgetAnnotation [disabled]:is(input,textarea){background:none;border:2px solid var(--input-disabled-border-color);cursor:not-allowed}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .textWidgetAnnotation :is(input,textarea):hover{border:2px solid var(--input-hover-border-color)}.annotationLayer .buttonWidgetAnnotation.checkBox input:hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .textWidgetAnnotation :is(input,textarea):hover{border-radius:2px}.annotationLayer .choiceWidgetAnnotation select:focus,.annotationLayer .textWidgetAnnotation :is(input,textarea):focus{background:none;border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) :focus{background-color:initial;background-image:none}.annotationLayer .buttonWidgetAnnotation.checkBox :focus{border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.radioButton :focus{border:2px solid var(--input-focus-border-color);outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{background-color:CanvasText;content:"";display:block;position:absolute}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{height:80%;left:45%;width:1px}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{transform:rotate(45deg)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{transform:rotate(-45deg)}.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{border-radius:50%;height:50%;left:25%;top:25%;width:50%}.annotationLayer .textWidgetAnnotation input.comb{font-family:monospace;padding-left:2px;padding-right:0}.annotationLayer .textWidgetAnnotation input.comb:focus{width:103%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{-webkit-appearance:none;-moz-appearance:none;appearance:none}.annotationLayer .fileAttachmentAnnotation .popupTriggerArea{height:100%;width:100%}.annotationLayer .popupAnnotation{font-size:calc(9px*var(--scale-factor));height:auto;max-width:45%;pointer-events:none;position:absolute;width:-moz-max-content;width:max-content}.annotationLayer .popup{word-wrap:break-word;background-color:#ff9;border-radius:calc(2px*var(--scale-factor));box-shadow:0 calc(2px*var(--scale-factor)) calc(5px*var(--scale-factor)) #888;cursor:pointer;font:message-box;outline:1.5px solid #ffff4a;padding:calc(6px*var(--scale-factor));pointer-events:auto;white-space:normal}.annotationLayer .popupAnnotation.focused .popup{outline-width:3px}.annotationLayer .popup *{font-size:calc(9px*var(--scale-factor))}.annotationLayer .popup>.header{display:inline-block}.annotationLayer .popup>.header h1{display:inline}.annotationLayer .popup>.header .popupDate{display:inline-block;margin-left:calc(5px*var(--scale-factor));width:-moz-fit-content;width:fit-content}.annotationLayer .popupContent{border-top:1px solid #333;margin-top:calc(2px*var(--scale-factor));padding-top:calc(2px*var(--scale-factor))}.annotationLayer .richText>*{font-size:calc(9px*var(--scale-factor));white-space:pre-wrap}.annotationLayer .popupTriggerArea{cursor:pointer}.annotationLayer section svg{height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer .annotationTextContent{color:#0000;height:100%;opacity:0;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}:is(.annotationLayer .annotationTextContent) span{display:inline-block;width:100%}.annotationLayer svg.quadrilateralsContainer{contain:strict;height:0;left:0;position:absolute;top:0;width:0;z-index:-1}:root{--xfa-unfocused-field-background:url(\'data:image/svg+xml;charset=utf-8,<svg width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" style="fill:rgba(0,54,255,.13)"/></svg>\');--xfa-focus-outline:auto}@media screen and (forced-colors:active){:root{--xfa-focus-outline:2px solid CanvasText}.xfaLayer :required{outline:1.5px solid selectedItem}}.xfaLayer{background-color:initial}.xfaLayer .highlight{background-color:#efcbed;border-radius:4px;margin:-1px;padding:1px}.xfaLayer .highlight.appended{position:static}.xfaLayer .highlight.begin{border-radius:4px 0 0 4px}.xfaLayer .highlight.end{border-radius:0 4px 4px 0}.xfaLayer .highlight.middle{border-radius:0}.xfaLayer .highlight.selected{background-color:#cbdfcb}.xfaPage{overflow:hidden;position:relative}.xfaContentarea{position:absolute}.xfaPrintOnly{display:none}.xfaLayer{left:0;line-height:1.2;position:absolute;text-align:initial;top:0;transform-origin:0 0}.xfaLayer *{background-color:initial;box-sizing:border-box;color:inherit;font:inherit;font-kerning:inherit;font-style:inherit;font-weight:inherit;letter-spacing:-.01px;line-height:inherit;margin:0;padding:0;pointer-events:auto;text-align:inherit;text-decoration:inherit}.xfaLayer :required{outline:1.5px solid red}.xfaLayer div,.xfaLayer svg,.xfaLayer svg *{pointer-events:none}.xfaLayer a{color:blue}.xfaRich li{margin-left:3em}.xfaFont{color:#000;font-kerning:none;font-size:10px;font-style:normal;font-weight:400;letter-spacing:0;text-decoration:none;vertical-align:0}.xfaCaption{flex:0 0 auto;overflow:hidden}.xfaCaptionForCheckButton{flex:1 1 auto;overflow:hidden}.xfaLabel{height:100%;width:100%}.xfaLeft{flex-direction:row}.xfaLeft,.xfaRight{align-items:center;display:flex}.xfaRight{flex-direction:row-reverse}:is(.xfaLeft,.xfaRight)>:is(.xfaCaption,.xfaCaptionForCheckButton){max-height:100%}.xfaTop{flex-direction:column}.xfaBottom,.xfaTop{align-items:flex-start;display:flex}.xfaBottom{flex-direction:column-reverse}:is(.xfaTop,.xfaBottom)>:is(.xfaCaption,.xfaCaptionForCheckButton){width:100%}.xfaBorder{background-color:initial;pointer-events:none;position:absolute}.xfaWrapped{height:100%;width:100%}:is(.xfaTextfield,.xfaSelect):focus{background-color:initial;background-image:none;outline:var(--xfa-focus-outline);outline-offset:-1px}:is(.xfaCheckbox,.xfaRadio):focus{outline:var(--xfa-focus-outline)}.xfaSelect,.xfaTextfield{background-image:var(--xfa-unfocused-field-background);border:none;flex:1 1 auto;height:100%;resize:none;width:100%}.xfaSelect{padding-inline:2px}:is(.xfaTop,.xfaBottom)>:is(.xfaTextfield,.xfaSelect){flex:0 1 auto}.xfaButton{border:none;cursor:pointer;text-align:center}.xfaButton,.xfaLink{height:100%;width:100%}.xfaLink{left:0;position:absolute;top:0}.xfaCheckbox,.xfaRadio{border:none;flex:0 0 auto;height:100%;width:100%}.xfaRich{white-space:pre-wrap}.xfaImage,.xfaRich{height:100%;width:100%}.xfaImage{-o-object-fit:contain;object-fit:contain;-o-object-position:left top;object-position:left top}.xfaLrTb,.xfaRlTb,.xfaTb{flex-direction:column}.xfaLr,.xfaLrTb,.xfaRlTb,.xfaTb{align-items:stretch;display:flex}.xfaLr{flex-direction:row}.xfaRl{align-items:stretch;display:flex;flex-direction:row-reverse}.xfaTb>div{justify-content:left}.xfaArea,.xfaPosition{position:relative}.xfaValignMiddle{align-items:center;display:flex}.xfaTable{flex-direction:column}.xfaTable,.xfaTable .xfaRow{align-items:stretch;display:flex}.xfaTable .xfaRow{flex-direction:row}.xfaTable .xfaRlRow{align-items:stretch;display:flex;flex:1;flex-direction:row-reverse}.xfaTable .xfaRlRow>div{flex:1}:is(.xfaNonInteractive,.xfaDisabled,.xfaReadOnly) :is(input,textarea){background:initial}@media print{.xfaSelect,.xfaTextfield{background:#0000}.xfaSelect{-webkit-appearance:none;-moz-appearance:none;appearance:none;text-indent:1px;text-overflow:""}}.canvasWrapper svg{transform:none}.moving:is(.canvasWrapper svg){z-index:100000}[data-main-rotation="90"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="90"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){transform:matrix(0,1,-1,0,1,0)}[data-main-rotation="180"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="180"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){transform:matrix(-1,0,0,-1,1,1)}[data-main-rotation="270"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="270"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){transform:matrix(0,-1,1,0,0,1)}.draw:is(.canvasWrapper svg){mix-blend-mode:normal;position:absolute}.draw[data-draw-rotation="90"]:is(.canvasWrapper svg){transform:rotate(90deg)}.draw[data-draw-rotation="180"]:is(.canvasWrapper svg){transform:rotate(180deg)}.draw[data-draw-rotation="270"]:is(.canvasWrapper svg){transform:rotate(270deg)}.highlight:is(.canvasWrapper svg){--blend-mode:multiply}@media screen and (forced-colors:active){.highlight:is(.canvasWrapper svg){--blend-mode:difference}}.highlight:is(.canvasWrapper svg){mix-blend-mode:var(--blend-mode);position:absolute}.highlight:is(.canvasWrapper svg):not(.free){fill-rule:evenodd}.highlightOutline:is(.canvasWrapper svg){fill-rule:evenodd;fill:none;mix-blend-mode:normal;position:absolute}.highlightOutline.hovered:is(.canvasWrapper svg):not(.free):not(.selected){stroke:var(--hover-outline-color);stroke-width:var(--outline-width)}.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .mainOutline{stroke:var(--outline-around-color);stroke-width:calc(var(--outline-width) + var(--outline-around-width)*2)}.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .secondaryOutline{stroke:var(--outline-color);stroke-width:var(--outline-width)}.highlightOutline.free.hovered:is(.canvasWrapper svg):not(.selected){stroke:var(--hover-outline-color);stroke-width:calc(var(--outline-width)*2)}.highlightOutline.free.selected:is(.canvasWrapper svg) .mainOutline{stroke:var(--outline-around-color);stroke-width:calc((var(--outline-width) + var(--outline-around-width))*2)}.highlightOutline.free.selected:is(.canvasWrapper svg) .secondaryOutline{stroke:var(--outline-color);stroke-width:calc(var(--outline-width)*2)}.toggle-button{--button-background-color:#f0f0f4;--button-background-color-hover:#e0e0e6;--button-background-color-active:#cfcfd8;--color-accent-primary:#0060df;--color-accent-primary-hover:#0250bb;--color-accent-primary-active:#054096;--border-interactive-color:#8f8f9d;--border-radius-circle:9999px;--border-width:1px;--size-item-small:16px;--size-item-large:32px;--color-canvas:#fff}@media (prefers-color-scheme:dark){.toggle-button{--button-background-color:color-mix(in srgb,currentColor 7%,#0000);--button-background-color-hover:color-mix(in srgb,currentColor 14%,#0000);--button-background-color-active:color-mix(in srgb,currentColor 21%,#0000);--color-accent-primary:#0df;--color-accent-primary-hover:#80ebff;--color-accent-primary-active:#aaf2ff;--border-interactive-color:#bfbfc9;--color-canvas:#1c1b22}}@media (forced-colors:active){.toggle-button{--color-accent-primary:ButtonText;--color-accent-primary-hover:SelectedItem;--color-accent-primary-active:SelectedItem;--border-interactive-color:ButtonText;--button-background-color:ButtonFace;--border-interactive-color-hover:SelectedItem;--border-interactive-color-active:SelectedItem;--border-interactive-color-disabled:GrayText;--color-canvas:ButtonText}}.toggle-button{--toggle-background-color:var(--button-background-color);--toggle-background-color-hover:var(--button-background-color-hover);--toggle-background-color-active:var(--button-background-color-active);--toggle-background-color-pressed:var(--color-accent-primary);--toggle-background-color-pressed-hover:var(--color-accent-primary-hover);--toggle-background-color-pressed-active:var(--color-accent-primary-active);--toggle-border-color:var(--border-interactive-color);--toggle-border-color-hover:var(--toggle-border-color);--toggle-border-color-active:var(--toggle-border-color);--toggle-border-radius:var(--border-radius-circle);--toggle-border-width:var(--border-width);--toggle-height:var(--size-item-small);--toggle-width:var(--size-item-large);--toggle-dot-background-color:var(--toggle-border-color);--toggle-dot-background-color-hover:var(--toggle-dot-background-color);--toggle-dot-background-color-active:var(--toggle-dot-background-color);--toggle-dot-background-color-on-pressed:var(--color-canvas);--toggle-dot-margin:1px;--toggle-dot-height:calc(var(--toggle-height) - var(--toggle-dot-margin)*2 - var(--toggle-border-width)*2);--toggle-dot-width:var(--toggle-dot-height);--toggle-dot-transform-x:calc(var(--toggle-width) - var(--toggle-dot-margin)*4 - var(--toggle-dot-width));-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--toggle-background-color);border:var(--toggle-border-width) solid var(--toggle-border-color);border-radius:var(--toggle-border-radius);box-sizing:border-box;flex-shrink:0;height:var(--toggle-height);margin:0;padding:0;width:var(--toggle-width)}.toggle-button:focus-visible{outline:var(--focus-outline);outline-offset:var(--focus-outline-offset)}.toggle-button:enabled:hover{background:var(--toggle-background-color-hover);border-color:var(--toggle-border-color)}.toggle-button:enabled:active{background:var(--toggle-background-color-active);border-color:var(--toggle-border-color)}.toggle-button[aria-pressed=true]{background:var(--toggle-background-color-pressed);border-color:#0000}.toggle-button[aria-pressed=true]:enabled:hover{background:var(--toggle-background-color-pressed-hover);border-color:#0000}.toggle-button[aria-pressed=true]:enabled:active{background:var(--toggle-background-color-pressed-active);border-color:#0000}.toggle-button:before{background-color:var(--toggle-dot-background-color);border-radius:var(--toggle-border-radius);content:"";display:block;height:var(--toggle-dot-height);margin:var(--toggle-dot-margin);translate:0;width:var(--toggle-dot-width)}.toggle-button[aria-pressed=true]:before{translate:var(--toggle-dot-transform-x)}.toggle-button[aria-pressed=true]:before,.toggle-button[aria-pressed=true]:enabled:active:before,.toggle-button[aria-pressed=true]:enabled:hover:before{background-color:var(--toggle-dot-background-color-on-pressed)}[dir=rtl] .toggle-button[aria-pressed=true]:before{translate:calc(var(--toggle-dot-transform-x)*-1)}@media (prefers-reduced-motion:no-preference){.toggle-button:before{transition:translate .1s}}@media (prefers-contrast){.toggle-button:enabled:hover{border-color:var(--toggle-border-color-hover)}.toggle-button:enabled:active{border-color:var(--toggle-border-color-active)}.toggle-button[aria-pressed=true]:enabled{border-color:var(--toggle-border-color);position:relative}.toggle-button[aria-pressed=true]:enabled:hover,.toggle-button[aria-pressed=true]:enabled:hover:active{border-color:var(--toggle-border-color-hover)}.toggle-button[aria-pressed=true]:enabled:active{background-color:var(--toggle-dot-background-color-active);border-color:var(--toggle-dot-background-color-hover)}.toggle-button:active:before,.toggle-button:hover:before{background-color:var(--toggle-dot-background-color-hover)}}@media (forced-colors){.toggle-button{--toggle-dot-background-color:var(--color-accent-primary);--toggle-dot-background-color-hover:var(--color-accent-primary-hover);--toggle-dot-background-color-active:var(--color-accent-primary-active);--toggle-dot-background-color-on-pressed:var(--button-background-color);--toggle-background-color-disabled:var(--button-background-color-disabled);--toggle-border-color-hover:var(--border-interactive-color-hover);--toggle-border-color-active:var(--border-interactive-color-active);--toggle-border-color-disabled:var(--border-interactive-color-disabled)}.toggle-button[aria-pressed=true]:enabled:after{border:1px solid var(--button-background-color);border-radius:var(--toggle-border-radius);content:"";display:block;height:var(--toggle-height);inset:-2px;position:absolute;width:var(--toggle-width)}.toggle-button[aria-pressed=true]:enabled:active:after{border-color:var(--toggle-border-color-active)}}:root{--outline-width:2px;--outline-color:#0060df;--outline-around-width:1px;--outline-around-color:#f0f0f4;--hover-outline-around-color:var(--outline-around-color);--focus-outline:solid var(--outline-width) var(--outline-color);--unfocus-outline:solid var(--outline-width) #0000;--focus-outline-around:solid var(--outline-around-width) var(--outline-around-color);--hover-outline-color:#8f8f9d;--hover-outline:solid var(--outline-width) var(--hover-outline-color);--hover-outline-around:solid var(--outline-around-width) var(--hover-outline-around-color);--freetext-line-height:1.35;--freetext-padding:2px;--resizer-bg-color:var(--outline-color);--resizer-size:6px;--resizer-shift:calc(0px - (var(--outline-width) + var(--resizer-size))/2 - var(--outline-around-width));--editorFreeText-editing-cursor:text;--editorInk-editing-cursor:url(images/cursor-editorInk.svg) 0 16,pointer;--editorHighlight-editing-cursor:url(images/cursor-editorTextHighlight.svg) 24 24,text;--editorFreeHighlight-editing-cursor:url(images/cursor-editorFreeHighlight.svg) 1 18,pointer;--new-alt-text-warning-image:url(images/altText_warning.svg)}.visuallyHidden{border:0;font-size:0;height:0;left:0;margin:0;overflow:hidden;padding:0;position:absolute;top:0;white-space:nowrap;width:0}.textLayer.highlighting{cursor:var(--editorFreeHighlight-editing-cursor)}.textLayer.highlighting:not(.free) span{cursor:var(--editorHighlight-editing-cursor)}.textLayer.highlighting.free span,[role=img]:is(.textLayer.highlighting:not(.free) span){cursor:var(--editorFreeHighlight-editing-cursor)}:is(#viewerContainer.pdfPresentationMode:fullscreen,.annotationEditorLayer.disabled) .noAltTextBadge{display:none!important}@media (min-resolution:1.1dppx){:root{--editorFreeText-editing-cursor:url(images/cursor-editorFreeText.svg) 0 16,text}}@media screen and (forced-colors:active){:root{--outline-color:CanvasText;--outline-around-color:ButtonFace;--resizer-bg-color:ButtonText;--hover-outline-color:Highlight;--hover-outline-around-color:SelectedItemText}}[data-editor-rotation="90"]{transform:rotate(90deg)}[data-editor-rotation="180"]{transform:rotate(180deg)}[data-editor-rotation="270"]{transform:rotate(270deg)}.annotationEditorLayer{background:#0000;cursor:auto;font-size:calc(100px*var(--scale-factor));inset:0;position:absolute;transform-origin:0 0}.annotationEditorLayer .selectedEditor{z-index:100000!important}.annotationEditorLayer.drawing *{pointer-events:none!important}.annotationEditorLayer.waiting{content:"";cursor:wait;height:100%;inset:0;position:absolute;width:100%}.annotationEditorLayer.disabled{pointer-events:none}.annotationEditorLayer.freetextEditing{cursor:var(--editorFreeText-editing-cursor)}.annotationEditorLayer.inkEditing{cursor:var(--editorInk-editing-cursor)}.annotationEditorLayer .draw{box-sizing:border-box}.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor){background:#0000;border:var(--unfocus-outline);cursor:auto;max-height:100%;max-width:100%;position:absolute;transform-origin:0 0;z-index:1}.draggable.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)){cursor:move}.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)){border:var(--focus-outline);outline:var(--focus-outline-around)}.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)):before{border:var(--focus-outline-around);content:"";inset:0;pointer-events:none;position:absolute}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)):hover:not(.selectedEditor){border:var(--hover-outline);outline:var(--hover-outline-around)}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)):hover:not(.selectedEditor):before{border:var(--focus-outline-around);content:"";inset:0;position:absolute}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{--editor-toolbar-delete-image:url(images/editor-toolbar-delete.svg);--editor-toolbar-bg-color:#f0f0f4;--editor-toolbar-highlight-image:url(images/toolbarButton-editorHighlight.svg);--editor-toolbar-fg-color:#2e2e56;--editor-toolbar-border-color:#8f8f9d;--editor-toolbar-hover-border-color:var(--editor-toolbar-border-color);--editor-toolbar-hover-bg-color:#e0e0e6;--editor-toolbar-hover-fg-color:var(--editor-toolbar-fg-color);--editor-toolbar-hover-outline:none;--editor-toolbar-focus-outline-color:#0060df;--editor-toolbar-shadow:0 2px 6px 0 #3a394433;--editor-toolbar-vert-offset:6px;--editor-toolbar-height:28px;--editor-toolbar-padding:2px;--alt-text-done-color:#2ac3a2;--alt-text-warning-color:#0090ed;--alt-text-hover-done-color:var(--alt-text-done-color);--alt-text-hover-warning-color:var(--alt-text-warning-color)}@media (prefers-color-scheme:dark){:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{--editor-toolbar-bg-color:#2b2a33;--editor-toolbar-fg-color:#fbfbfe;--editor-toolbar-hover-bg-color:#52525e;--editor-toolbar-focus-outline-color:#0df;--alt-text-done-color:#54ffbd;--alt-text-warning-color:#80ebff}}@media screen and (forced-colors:active){:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{--editor-toolbar-bg-color:ButtonFace;--editor-toolbar-fg-color:ButtonText;--editor-toolbar-border-color:ButtonText;--editor-toolbar-hover-border-color:AccentColor;--editor-toolbar-hover-bg-color:ButtonFace;--editor-toolbar-hover-fg-color:AccentColor;--editor-toolbar-hover-outline:2px solid var(--editor-toolbar-hover-border-color);--editor-toolbar-focus-outline-color:ButtonBorder;--editor-toolbar-shadow:none;--alt-text-done-color:var(--editor-toolbar-fg-color);--alt-text-warning-color:var(--editor-toolbar-fg-color);--alt-text-hover-done-color:var(--editor-toolbar-hover-fg-color);--alt-text-hover-warning-color:var(--editor-toolbar-hover-fg-color)}}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{align-items:center;background-color:var(--editor-toolbar-bg-color);border:1px solid var(--editor-toolbar-border-color);border-radius:6px;box-shadow:var(--editor-toolbar-shadow);box-sizing:initial;cursor:default;display:flex;flex-direction:column;height:var(--editor-toolbar-height);inset-block-start:calc(100% + var(--editor-toolbar-vert-offset));inset-inline-end:0;justify-content:center;padding:var(--editor-toolbar-padding);pointer-events:auto;position:absolute;width:-moz-fit-content;width:fit-content}.hidden:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){display:none}:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar):has(:focus-visible){border-color:#0000}[dir=ltr] :is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){transform-origin:100% 0}[dir=rtl] :is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){transform-origin:0 0}:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons{align-items:center;display:flex;gap:0;height:100%;justify-content:center}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) button{padding:0}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .divider{border-left:1px solid var(--editor-toolbar-border-color);border-right:none;display:inline-block;height:calc(var(--editor-toolbar-padding)*2 + var(--editor-toolbar-height));margin-inline:2px;width:0}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton{width:var(--editor-toolbar-height)}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton):before{background-color:var(--editor-toolbar-fg-color);content:"";display:inline-block;height:100%;-webkit-mask-image:var(--editor-toolbar-highlight-image);mask-image:var(--editor-toolbar-highlight-image);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;width:100%}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton):hover:before{background-color:var(--editor-toolbar-hover-fg-color)}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete{width:var(--editor-toolbar-height)}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete):before{background-color:var(--editor-toolbar-fg-color);content:"";display:inline-block;height:100%;-webkit-mask-image:var(--editor-toolbar-delete-image);mask-image:var(--editor-toolbar-delete-image);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;width:100%}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete):hover:before{background-color:var(--editor-toolbar-hover-fg-color)}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>*{height:var(--editor-toolbar-height)}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>:not(.divider){background-color:initial;border:none;cursor:pointer}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>:not(.divider)):hover{background-color:var(--editor-toolbar-hover-bg-color);border-radius:2px;color:var(--editor-toolbar-hover-fg-color);outline:var(--editor-toolbar-hover-outline);outline-offset:1px}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>:not(.divider)):hover:active{outline:none}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>:not(.divider)):focus-visible{border-radius:2px;outline:2px solid var(--editor-toolbar-focus-outline-color)}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText{--alt-text-add-image:url(images/altText_add.svg);--alt-text-done-image:url(images/altText_done.svg);align-items:center;color:var(--editor-toolbar-fg-color);display:flex;font:menu;font-size:12px;font-weight:590;justify-content:center;padding-inline:8px;pointer-events:all;width:-moz-max-content;width:max-content}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):disabled{pointer-events:none}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):before{background-color:var(--editor-toolbar-fg-color);content:"";display:inline-block;height:13px;margin-inline-end:4px;-webkit-mask-image:var(--alt-text-add-image);mask-image:var(--alt-text-add-image);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;width:12px}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover:before{background-color:var(--editor-toolbar-hover-fg-color)}.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):before{-webkit-mask-image:var(--alt-text-done-image);mask-image:var(--alt-text-done-image)}.new:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):before{background-color:var(--alt-text-warning-color);height:16px;-webkit-mask-image:var(--new-alt-text-warning-image);mask-image:var(--new-alt-text-warning-image);-webkit-mask-size:cover;mask-size:cover;width:16px}.new:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover:before{background-color:var(--alt-text-hover-warning-color)}.new.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):before{background-color:var(--alt-text-done-color);-webkit-mask-image:var(--alt-text-done-image);mask-image:var(--alt-text-done-image)}.new.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover:before{background-color:var(--alt-text-hover-done-color)}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip{word-wrap:anywhere;display:none}.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){--alt-text-tooltip-bg:#f0f0f4;--alt-text-tooltip-fg:#15141a;--alt-text-tooltip-border:#8f8f9d;--alt-text-tooltip-shadow:0px 2px 6px 0px #3a394433}@media (prefers-color-scheme:dark){.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){--alt-text-tooltip-bg:#1c1b22;--alt-text-tooltip-fg:#fbfbfe;--alt-text-tooltip-shadow:0px 2px 6px 0px #15141a}}@media screen and (forced-colors:active){.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){--alt-text-tooltip-bg:Canvas;--alt-text-tooltip-fg:CanvasText;--alt-text-tooltip-border:CanvasText;--alt-text-tooltip-shadow:none}}.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){align-items:center;background:var(--alt-text-tooltip-bg);border:.5px solid var(--alt-text-tooltip-border);box-shadow:var(--alt-text-tooltip-shadow);color:var(--alt-text-tooltip-fg);display:inline-flex;flex-direction:column;font-size:12px;height:auto;inset-inline-start:0;justify-content:center;max-width:300px;padding-block:2px 3px;padding-inline:3px;pointer-events:none;position:absolute;top:calc(100% + 2px);width:-moz-max-content;width:max-content}.annotationEditorLayer .freeTextEditor{height:auto;padding:calc(var(--freetext-padding)*var(--scale-factor));touch-action:none;width:auto}.annotationEditorLayer .freeTextEditor .internal{background:#0000;border:none;font:10px sans-serif;inset:0;line-height:var(--freetext-line-height);overflow:visible;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.annotationEditorLayer .freeTextEditor .overlay{background:#0000;display:none;height:100%;inset:0;position:absolute;width:100%}.annotationEditorLayer freeTextEditor .overlay.enabled{display:block}.annotationEditorLayer .freeTextEditor .internal:empty:before{color:gray;content:attr(default-content)}.annotationEditorLayer .freeTextEditor .internal:focus{outline:none;-webkit-user-select:auto;-moz-user-select:auto;user-select:auto}.annotationEditorLayer .inkEditor{height:100%;width:100%}.annotationEditorLayer .inkEditor.editing{cursor:inherit}.annotationEditorLayer .inkEditor .inkEditorCanvas{height:100%;inset:0;position:absolute;touch-action:none;width:100%}.annotationEditorLayer .stampEditor{height:auto;width:auto}:is(.annotationEditorLayer .stampEditor) canvas{height:100%;left:0;margin:0;position:absolute;top:0;width:100%}:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{--no-alt-text-badge-border-color:#f0f0f4;--no-alt-text-badge-bg-color:#cfcfd8;--no-alt-text-badge-fg-color:#5b5b66}@media (prefers-color-scheme:dark){:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{--no-alt-text-badge-border-color:#52525e;--no-alt-text-badge-bg-color:#fbfbfe;--no-alt-text-badge-fg-color:#15141a}}@media screen and (forced-colors:active){:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{--no-alt-text-badge-border-color:ButtonText;--no-alt-text-badge-bg-color:ButtonFace;--no-alt-text-badge-fg-color:ButtonText}}:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{align-items:center;background:var(--no-alt-text-badge-bg-color);border:1px solid var(--no-alt-text-badge-border-color);border-radius:2px;display:inline-flex;height:32px;inset-block-end:5px;inset-inline-end:5px;justify-content:center;padding:3px;pointer-events:none;position:absolute;width:32px;z-index:1}:is(:is(.annotationEditorLayer .stampEditor) .noAltTextBadge):before{background-color:var(--no-alt-text-badge-fg-color);content:"";display:inline-block;height:16px;-webkit-mask-image:var(--new-alt-text-warning-image);mask-image:var(--new-alt-text-warning-image);-webkit-mask-size:cover;mask-size:cover;width:16px}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers{inset:0;position:absolute}.hidden:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers){display:none}:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer{background:content-box var(--resizer-bg-color);border:var(--focus-outline-around);border-radius:2px;height:var(--resizer-size);position:absolute;width:var(--resizer-size)}.topLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){left:var(--resizer-shift);top:var(--resizer-shift)}.topMiddle:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){left:calc(50% + var(--resizer-shift));top:var(--resizer-shift)}.topRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){right:var(--resizer-shift);top:var(--resizer-shift)}.middleRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){right:var(--resizer-shift);top:calc(50% + var(--resizer-shift))}.bottomRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){bottom:var(--resizer-shift);right:var(--resizer-shift)}.bottomMiddle:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){bottom:var(--resizer-shift);left:calc(50% + var(--resizer-shift))}.bottomLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){bottom:var(--resizer-shift);left:var(--resizer-shift)}.middleLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){left:var(--resizer-shift);top:calc(50% + var(--resizer-shift))}.bottomRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer),.topLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer){cursor:nwse-resize}.bottomMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer),.topMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer){cursor:ns-resize}.bottomLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer),.topRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer){cursor:nesw-resize}.middleLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer),.middleRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer){cursor:ew-resize}.bottomRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer),.topLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer){cursor:nesw-resize}.bottomMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer),.topMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer){cursor:ew-resize}.bottomLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer),.topRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer){cursor:nwse-resize}.middleLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer),.middleRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer){cursor:ns-resize}:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar{rotate:270deg}[dir=ltr] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar){inset-block-start:0;inset-inline-end:calc(0px - var(--editor-toolbar-vert-offset))}[dir=rtl] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar){inset-block-start:0;inset-inline-end:calc(100% + var(--editor-toolbar-vert-offset))}:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="180"],[data-main-rotation="90"] [data-editor-rotation="90"],[data-main-rotation="180"] [data-editor-rotation="0"],[data-main-rotation="270"] [data-editor-rotation="270"])) .editToolbar{inset-block-start:calc(0pc - var(--editor-toolbar-vert-offset));inset-inline-end:100%;rotate:180deg}:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar{rotate:90deg}[dir=ltr] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar){inset-block-start:100%;inset-inline-end:calc(100% + var(--editor-toolbar-vert-offset))}[dir=rtl] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar){inset-block-start:0;inset-inline-start:calc(0px - var(--editor-toolbar-vert-offset))}.dialog.altText::backdrop{-webkit-mask:url(#alttext-manager-mask);mask:url(#alttext-manager-mask)}.dialog.altText.positioned{margin:0}.dialog.altText #altTextContainer{align-items:flex-start;display:inline-flex;flex-direction:column;gap:16px;height:-moz-fit-content;height:fit-content;width:300px}:is(.dialog.altText #altTextContainer) #overallDescription{align-items:flex-start;align-self:stretch;display:flex;flex-direction:column;gap:4px}:is(:is(.dialog.altText #altTextContainer) #overallDescription) span{align-self:stretch}:is(:is(.dialog.altText #altTextContainer) #overallDescription) .title{font-size:13px;font-style:normal;font-weight:590}:is(.dialog.altText #altTextContainer) #addDescription{align-items:stretch;display:flex;flex-direction:column;gap:8px}:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea{flex:1;padding-inline:24px 10px}:is(:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea) textarea{min-height:75px;width:100%}:is(.dialog.altText #altTextContainer) #buttons{align-items:flex-start;align-self:stretch;display:flex;gap:8px;justify-content:flex-end}.dialog.newAltText{--new-alt-text-ai-disclaimer-icon:url(images/altText_disclaimer.svg);--new-alt-text-spinner-icon:url(images/altText_spinner.svg);--preview-image-bg-color:#f0f0f4;--preview-image-border:none}@media (prefers-color-scheme:dark){.dialog.newAltText{--preview-image-bg-color:#2b2a33}}@media screen and (forced-colors:active){.dialog.newAltText{--preview-image-bg-color:ButtonFace;--preview-image-border:1px solid ButtonText}}.dialog.newAltText{max-width:570px;min-width:300px;padding:0;width:80%}.dialog.newAltText.aiInstalling #newAltTextCreateAutomatically,.dialog.newAltText.noAi #newAltTextCreateAutomatically,.dialog.newAltText.noAi #newAltTextDisclaimer{display:none!important}.dialog.newAltText.aiInstalling #newAltTextDownloadModel{display:flex!important}.dialog.newAltText.error #newAltTextNotNow{display:none!important}.dialog.newAltText.error #newAltTextCancel{display:inline-block!important}.dialog.newAltText:not(.error) #newAltTextError{display:none!important}.dialog.newAltText #newAltTextContainer{align-items:flex-start;display:flex;flex:0 1 auto;flex-direction:column;gap:12px;justify-content:flex-end;line-height:normal;padding:16px;width:auto}:is(.dialog.newAltText #newAltTextContainer) #mainContent{align-items:flex-start;align-self:stretch;display:flex;flex:1 1 auto;gap:12px;justify-content:flex-end}:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionAndSettings{align-items:flex-start;align-self:stretch;display:flex;flex:1 0 0;flex-direction:column;gap:16px}:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction{align-items:flex-start;align-self:stretch;display:flex;flex:1 1 auto;flex-direction:column;gap:8px}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer{height:70px;position:relative;width:100%}:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea{height:100%;padding:8px;width:100%}:is(:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea)::-moz-placeholder{color:var(--text-secondary-color)}:is(:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea)::placeholder{color:var(--text-secondary-color)}:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) .altTextSpinner{background-color:var(--text-secondary-color);display:none;height:16px;inset-block-start:8px;inset-inline-start:8px;-webkit-mask-size:cover;mask-size:cover;pointer-events:none;position:absolute;width:16px}.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea::-moz-placeholder{color:#0000}.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea::placeholder{color:#0000}.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) .altTextSpinner{display:inline-block;-webkit-mask-image:var(--new-alt-text-spinner-icon);mask-image:var(--new-alt-text-spinner-icon)}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescription{font-size:11px}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDisclaimer{align-items:flex-start;display:flex;flex-direction:row;font-size:11px;gap:4px}:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDisclaimer):before{background-color:var(--text-secondary-color);content:"";display:inline-block;flex:1 0 auto;height:16px;-webkit-mask-image:var(--new-alt-text-ai-disclaimer-icon);mask-image:var(--new-alt-text-ai-disclaimer-icon);-webkit-mask-size:cover;mask-size:cover;width:17px}:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextDownloadModel{align-items:center;align-self:stretch;display:flex;gap:4px}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextDownloadModel):before{background-color:var(--text-secondary-color);content:"";display:inline-block;height:16px;-webkit-mask-image:var(--new-alt-text-spinner-icon);mask-image:var(--new-alt-text-spinner-icon);-webkit-mask-size:cover;mask-size:cover;width:16px}:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextImagePreview{align-items:center;aspect-ratio:1;background-color:var(--preview-image-bg-color);border:var(--preview-image-border);display:flex;flex:0 0 auto;justify-content:center;width:180px}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextImagePreview)>canvas{max-height:100%;max-width:100%}.colorPicker{--hover-outline-color:#0250bb;--selected-outline-color:#0060df;--swatch-border-color:#cfcfd8}@media (prefers-color-scheme:dark){.colorPicker{--hover-outline-color:#80ebff;--selected-outline-color:#aaf2ff;--swatch-border-color:#52525e}}@media screen and (forced-colors:active){.colorPicker{--hover-outline-color:Highlight;--selected-outline-color:var(--hover-outline-color);--swatch-border-color:ButtonText}}.colorPicker .swatch{border:1px solid var(--swatch-border-color);border-radius:100%;box-sizing:border-box;forced-color-adjust:none;height:16px;outline-offset:2px;width:16px}.colorPicker button:is(:hover,.selected)>.swatch{border:none}.annotationEditorLayer[data-main-rotation="0"] .highlightEditor:not(.free)>.editToolbar{rotate:0deg}.annotationEditorLayer[data-main-rotation="90"] .highlightEditor:not(.free)>.editToolbar{rotate:270deg}.annotationEditorLayer[data-main-rotation="180"] .highlightEditor:not(.free)>.editToolbar{rotate:180deg}.annotationEditorLayer[data-main-rotation="270"] .highlightEditor:not(.free)>.editToolbar{rotate:90deg}.annotationEditorLayer .highlightEditor{background:#0000;border:none;cursor:auto;max-height:100%;max-width:100%;outline:none;pointer-events:none;position:absolute;transform-origin:0 0;z-index:1}:is(.annotationEditorLayer .highlightEditor):not(.free){transform:none}:is(.annotationEditorLayer .highlightEditor) .internal{height:100%;left:0;pointer-events:auto;position:absolute;top:0;width:100%}.disabled:is(.annotationEditorLayer .highlightEditor) .internal{pointer-events:none}.selectedEditor:is(.annotationEditorLayer .highlightEditor) .internal{cursor:pointer}:is(.annotationEditorLayer .highlightEditor) .editToolbar{--editor-toolbar-colorpicker-arrow-image:url(images/toolbarButton-menuArrow.svg);transform-origin:center!important}:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker{align-items:center;display:flex;gap:4px;justify-content:center;padding:4px;position:relative;width:auto}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):after{background-color:var(--editor-toolbar-fg-color);content:"";display:inline-block;height:12px;-webkit-mask-image:var(--editor-toolbar-colorpicker-arrow-image);mask-image:var(--editor-toolbar-colorpicker-arrow-image);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;width:12px}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):hover:after{background-color:var(--editor-toolbar-hover-fg-color)}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):has(.dropdown:not(.hidden)){background-color:var(--editor-toolbar-hover-bg-color)}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):has(.dropdown:not(.hidden)):after{scale:-1}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown{align-items:center;background-color:var(--editor-toolbar-bg-color);border:1px solid var(--editor-toolbar-border-color);border-radius:6px;box-shadow:var(--editor-toolbar-shadow);display:flex;flex-direction:column;gap:11px;inset-block-start:calc(100% + 4px);justify-content:center;padding-block:8px;position:absolute;width:calc(100% + var(--editor-toolbar-padding)*2)}:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button{align-items:center;background:none;border:none;cursor:pointer;display:flex;height:auto;justify-content:center;width:100%}:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button):is(:active,:focus-visible){outline:none}:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button)>.swatch{outline-offset:2px}[aria-selected=true]:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button)>.swatch{outline:2px solid var(--selected-outline-color)}:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button):is(:hover,:active,:focus-visible)>.swatch{outline:2px solid var(--hover-outline-color)}.editorParamsToolbar:has(#highlightParamsToolbarContainer){padding:unset}#highlightParamsToolbarContainer{gap:16px;padding-block-end:12px;padding-inline:10px}#highlightParamsToolbarContainer .colorPicker{display:flex;flex-direction:column;gap:8px}:is(#highlightParamsToolbarContainer .colorPicker) .dropdown{align-items:center;display:flex;flex-direction:row;height:auto;justify-content:space-between}:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button{align-items:center;background:none;border:none;cursor:pointer;display:flex;flex:0 0 auto;height:auto;justify-content:center;padding:0;width:auto}:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button) .swatch{height:24px;width:24px}:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button):is(:active,:focus-visible){outline:none}[aria-selected=true]:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button)>.swatch{outline:2px solid var(--selected-outline-color)}:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button):is(:hover,:active,:focus-visible)>.swatch{outline:2px solid var(--hover-outline-color)}#highlightParamsToolbarContainer #editorHighlightThickness{align-items:center;align-self:stretch;display:flex;flex-direction:column;gap:4px}:is(#highlightParamsToolbarContainer #editorHighlightThickness) .editorParamsLabel{align-self:stretch;height:auto}:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{--example-color:#bfbfc9;align-items:center;align-self:stretch;display:flex;justify-content:space-between}@media (prefers-color-scheme:dark){:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{--example-color:#80808e}}@media screen and (forced-colors:active){:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{--example-color:CanvasText}}:is(:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker)>.editorParamsSlider[disabled]){opacity:.4}:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker):after,:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker):before{aspect-ratio:1;background-color:var(--example-color);border-radius:100%;content:"";display:block;width:8px}:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker):after{width:24px}:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker) .editorParamsSlider{height:14px;width:unset}#highlightParamsToolbarContainer #editorHighlightVisibility{align-items:flex-start;align-self:stretch;display:flex;flex-direction:column;gap:8px}:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{--divider-color:#d7d7db}@media (prefers-color-scheme:dark){:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{--divider-color:#8f8f9d}}@media screen and (forced-colors:active){:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{--divider-color:CanvasText}}:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{background-color:var(--divider-color);height:1px;margin-block:4px;width:100%}:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .toggler{align-items:center;align-self:stretch;display:flex;justify-content:space-between}#altTextSettingsDialog{padding:16px}#altTextSettingsDialog #altTextSettingsContainer{display:flex;flex-direction:column;gap:16px;width:573px}:is(#altTextSettingsDialog #altTextSettingsContainer) .mainContainer{gap:16px}:is(#altTextSettingsDialog #altTextSettingsContainer) .description{color:var(--text-secondary-color)}:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings{display:flex;flex-direction:column;gap:12px}:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) button{width:-moz-fit-content;width:fit-content}.download:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) #deleteModelButton,:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings):not(.download) #downloadModelButton{display:none}:is(#altTextSettingsDialog #altTextSettingsContainer) #altTextEditor,:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticAltText{display:flex;flex-direction:column;gap:8px}:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings,:is(#altTextSettingsDialog #altTextSettingsContainer) #createModelDescription,:is(#altTextSettingsDialog #altTextSettingsContainer) #showAltTextDialogDescription{padding-inline-start:40px}:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticSettings{display:flex;flex-direction:column;gap:16px}:root{--viewer-container-height:0;--pdfViewer-padding-bottom:0;--page-margin:1px auto -8px;--page-border:9px solid #0000;--spreadHorizontalWrapped-margin-LR:-3.5px;--loading-icon-delay:400ms}@media screen and (forced-colors:active){:root{--pdfViewer-padding-bottom:9px;--page-margin:8px auto -1px;--page-border:1px solid CanvasText;--spreadHorizontalWrapped-margin-LR:3.5px}}[data-main-rotation="90"]{transform:rotate(90deg) translateY(-100%)}[data-main-rotation="180"]{transform:rotate(180deg) translate(-100%,-100%)}[data-main-rotation="270"]{transform:rotate(270deg) translateX(-100%)}#hiddenCopyElement,.hiddenCanvasElement{display:none;height:0;left:0;position:absolute;top:0;width:0}.pdfViewer{--scale-factor:1;--page-bg-color:unset;--hcm-highlight-filter:none;--hcm-highlight-selected-filter:none;padding-bottom:var(--pdfViewer-padding-bottom)}@media screen and (forced-colors:active){.pdfViewer{--hcm-highlight-filter:invert(100%)}}.pdfViewer.copyAll{cursor:wait}.pdfViewer .canvasWrapper{height:100%;overflow:hidden;width:100%}:is(.pdfViewer .canvasWrapper) canvas{contain:content;display:block;height:100%;left:0;margin:0;position:absolute;top:0;width:100%}:is(:is(.pdfViewer .canvasWrapper) canvas) .structTree{contain:strict}.pdfViewer .page{--scale-round-x:1px;--scale-round-y:1px;background-clip:content-box;background-color:var(--page-bg-color,#fff);border:var(--page-border);direction:ltr;height:1056px;margin:var(--page-margin);overflow:visible;position:relative;width:816px}.pdfViewer .dummyPage{height:var(--viewer-container-height);position:relative;width:0}.pdfViewer.noUserSelect{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pdfViewer.removePageBorders .page{border:none;margin:0 auto 10px}.pdfViewer.singlePageView{display:inline-block}.pdfViewer.singlePageView .page{border:none;margin:0}.pdfViewer:is(.scrollHorizontal,.scrollWrapped),.spread{margin-inline:3.5px;text-align:center}.pdfViewer.scrollHorizontal,.spread{white-space:nowrap}.pdfViewer.removePageBorders,.pdfViewer:is(.scrollHorizontal,.scrollWrapped) .spread{margin-inline:0}.pdfViewer:is(.scrollHorizontal,.scrollWrapped) :is(.page,.spread),.spread :is(.page,.dummyPage){display:inline-block;vertical-align:middle}.pdfViewer:is(.scrollHorizontal,.scrollWrapped) .page,.spread .page{margin-inline:var(--spreadHorizontalWrapped-margin-LR)}.pdfViewer.removePageBorders .spread .page,.pdfViewer.removePageBorders:is(.scrollHorizontal,.scrollWrapped) .page{margin-inline:5px}.pdfViewer .page.loadingIcon:after{background:url(images/loading-icon.gif) 50% no-repeat;contain:strict;content:"";display:none;height:100%;left:0;position:absolute;top:0;transition-delay:var(--loading-icon-delay);transition-property:display;width:100%;z-index:5}.pdfViewer .page.loading:after{display:block}.pdfViewer .page:not(.loading):after{display:none;transition-property:none}.pdfPresentationMode .pdfViewer{padding-bottom:0}.pdfPresentationMode .spread{margin:0}.pdfPresentationMode .pdfViewer .page{border:2px solid #0000;margin:0 auto}');var Wie=function(){function e(){}return e.generateUniqueId=function(){var e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return"".concat(e,"-").concat(t)},e}(),$ie=Symbol.for("immer-nothing"),qie=Symbol.for("immer-draftable"),Gie=Symbol.for("immer-state"),Yie="production"!==St.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Kie(e,...t){if("production"!==St.env.NODE_ENV){const n=Yie[e],r="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Xie=Object.getPrototypeOf;function Qie(e){return!!e&&!!e[Gie]}function Jie(e){return!!e&&(ele(e)||Array.isArray(e)||!!e[qie]||!!e.constructor?.[qie]||ole(e)||cle(e))}var Zie=Object.prototype.constructor.toString();function ele(e){if(!e||"object"!=typeof e)return!1;const t=Xie(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Zie}function tle(e,t){0===nle(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function nle(e){const t=e[Gie];return t?t.type_:Array.isArray(e)?1:ole(e)?2:cle(e)?3:0}function rle(e,t){return 2===nle(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ale(e,t,n){const r=nle(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ole(e){return e instanceof Map}function cle(e){return e instanceof Set}function ile(e){return e.copy_||e.base_}function lle(e,t){if(ole(e))return new Map(e);if(cle(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=ele(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Gie];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const a=n[r],o=t[a];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[a]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[a]})}return Object.create(Xie(e),t)}{const t=Xie(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function sle(e,t=!1){return dle(e)||Qie(e)||!Jie(e)||(nle(e)>1&&(e.set=e.add=e.clear=e.delete=hle),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>sle(t,!0)))),e}function hle(){Kie(2)}function dle(e){return Object.isFrozen(e)}var ule,mle={};function ple(e){const t=mle[e];return t||Kie(0,e),t}function vle(){return ule}function fle(e,t){t&&(ple("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function zle(e){gle(e),e.drafts_.forEach(Mle),e.drafts_=null}function gle(e){e===ule&&(ule=e.parent_)}function yle(e){return ule={drafts_:[],parent_:ule,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Mle(e){const t=e[Gie];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ele(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Gie].modified_&&(zle(t),Kie(4)),Jie(e)&&(e=ble(t,e),t.parent_||Vle(t,e)),t.patches_&&ple("Patches").generateReplacementPatches_(n[Gie].base_,e,t.patches_,t.inversePatches_)):e=ble(t,n,[]),zle(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$ie?e:void 0}function ble(e,t,n){if(dle(t))return t;const r=t[Gie];if(!r)return tle(t,((a,o)=>Hle(e,r,t,a,o,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return Vle(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let a=t,o=!1;3===r.type_&&(a=new Set(t),t.clear(),o=!0),tle(a,((a,c)=>Hle(e,r,t,a,c,n,o))),Vle(e,t,!1),n&&e.patches_&&ple("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Hle(e,t,n,r,a,o,c){if("production"!==St.env.NODE_ENV&&a===n&&Kie(5),Qie(a)){const c=ble(e,a,o&&t&&3!==t.type_&&!rle(t.assigned_,r)?o.concat(r):void 0);if(ale(n,r,c),!Qie(c))return;e.canAutoFreeze_=!1}else c&&n.add(a);if(Jie(a)&&!dle(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ble(e,a),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||Vle(e,a)}}function Vle(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sle(t,n)}var Cle={get(e,t){if(t===Gie)return e;const n=ile(e);if(!rle(n,t))return function(e,t,n){const r=wle(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Jie(r)?r:r===kle(e.base_,t)?(xle(e),e.copy_[t]=Tle(r,e)):r},has:(e,t)=>t in ile(e),ownKeys:e=>Reflect.ownKeys(ile(e)),set(e,t,n){const r=wle(ile(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=kle(ile(e),t),c=r?.[Gie];if(c&&c.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((a=n)===(o=r)?0!==a||1/a==1/o:a!=a&&o!=o)&&(void 0!==n||rle(e.base_,t)))return!0;xle(e),Sle(e)}var a,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==kle(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,xle(e),Sle(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ile(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Kie(11)},getPrototypeOf:e=>Xie(e.base_),setPrototypeOf(){Kie(12)}},Lle={};function kle(e,t){const n=e[Gie];return(n?ile(n):e)[t]}function wle(e,t){if(!(t in e))return;let n=Xie(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Xie(n)}}function Sle(e){e.modified_||(e.modified_=!0,e.parent_&&Sle(e.parent_))}function xle(e){e.copy_||(e.copy_=lle(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function Tle(e,t){const n=ole(e)?ple("MapSet").proxyMap_(e,t):cle(e)?ple("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:vle(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,o=Cle;n&&(a=[r],o=Lle);const{revoke:c,proxy:i}=Proxy.revocable(a,o);return r.draft_=i,r.revoke_=c,i}(e,t);return(t?t.scope_:vle()).drafts_.push(n),n}function Ole(e){if(!Jie(e)||dle(e))return e;const t=e[Gie];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=lle(e,t.scope_.immer_.useStrictShallowCopy_)}else n=lle(e,!0);return tle(n,((e,t)=>{ale(n,e,Ole(t))})),t&&(t.finalized_=!1),n}tle(Cle,((e,t)=>{Lle[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Lle.deleteProperty=function(e,t){return"production"!==St.env.NODE_ENV&&isNaN(parseInt(t))&&Kie(13),Lle.set.call(this,e,t,void 0)},Lle.set=function(e,t,n){return"production"!==St.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Kie(14),Cle.set.call(this,e[0],t,n,e[0])};var Ale=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...a){return r.produce(e,(e=>t.call(this,e,...a)))}}let r;if("function"!=typeof t&&Kie(6),void 0!==n&&"function"!=typeof n&&Kie(7),Jie(e)){const a=yle(this),o=Tle(e,void 0);let c=!0;try{r=t(o),c=!1}finally{c?zle(a):gle(a)}return fle(a,n),Ele(r,a)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===$ie&&(r=void 0),this.autoFreeze_&&sle(r,!0),n){const t=[],a=[];ple("Patches").generateReplacementPatches_(e,r,t,a),n(t,a)}return r}Kie(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Jie(e)||Kie(8),Qie(e)&&(e=function(e){return Qie(e)||Kie(10,e),Ole(e)}(e));const t=yle(this),n=Tle(e,void 0);return n[Gie].isManual_=!0,gle(t),n}finishDraft(e,t){const n=e&&e[Gie];n&&n.isManual_||Kie(9);const{scope_:r}=n;return fle(r,t),Ele(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ple("Patches").applyPatches_;return Qie(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Rle=Ale.produce;Ale.produceWithPatches.bind(Ale);var Nle=Ale.setAutoFreeze.bind(Ale);Ale.setUseStrictShallowCopy.bind(Ale),Ale.applyPatches.bind(Ale),Ale.createDraft.bind(Ale),Ale.finishDraft.bind(Ale);var _le={isScaleSaveHappening:!1,isAddNewScaleFormPopupOpen:!1,scaleName:"",paperDimension:{unitOfMeasurement:"inch",scalarQuantity:1},displayDimension:{unitOfMeasurement:"inch",scalarQuantity:1},precision:.1,userCalibratingScaleOnPdfPageDetails:{isHappening:!1,coordinates:[]},isCalibrationScaleFormPopupOpen:!1,pdfPageId:""},Dle={scaleId:"",popup:{isOpen:!1},paperDimension:{unitOfMeasurement:"inch",scalarQuantity:0},displayDimension:{unitOfMeasurement:"inch",scalarQuantity:0},scaleName:"",precision:.1,isScaleSaveHappening:!1},Ple=function(){function e(){}return e.getEnvValue=function(e){var t,n=null===(t=null===window||void 0===window?void 0:window._env_)||void 0===t?void 0:t[e];return n&&"default"!==n?n:""},e}(),Fle=function(){function e(){}return e.BACKEND_BASE_URL=Ple.getEnvValue("BACKEND_BASE_URL"),e.scalePrecisionOptions=[.1,.01,.001],e.annotationAvalaibleColors=[{color:"#E34234"},{color:"#FF8D02"},{color:"#FFCD44"},{color:"#5BC96D"},{color:"#26D2D2"},{color:"#587CE2"},{color:"#C544CE"},{color:"#7D2E25"},{color:"#A84F1C"},{color:"#E99E38"},{color:"#347842"},{color:"#167E7D"},{color:"#354A87"},{color:"#76287B"},{color:"#000"},{color:"#CDCDCD"},{color:"#9C9C9C"},{color:"#696969"},{color:"#272727"},{color:"#FFFFFF"}],e.pdfPagesElementId="pdf-pages-container",e}(),Ile={isOpen:!1,sections:{color:{collapsedStatus:"collapsed",currentlySelectedColor:Fle.annotationAvalaibleColors[0].color},coordinates:{collapsedStatus:"collapsed",shouldHighlightFirstCoordinate:!1,shouldHighlightSecondCoordinate:!1,x1:0,x2:0,y1:0,y2:0}}};Iie.workerSrc="https://unpkg.com/pdfjs-dist@4.10.38/build/pdf.worker.min.mjs",Nle(!1);var Ble={options:{showDividerBetweenToolSections:!0,alignmentOfFirstRowToolSections:"space-between"},sections:[[{name:"fullScreen"},{name:"zoomTool"}],[{name:"Annotation",children:[{name:"highlight"},{name:"callout"}]},{name:"Shapes",children:[{name:"rectangle"}]},{name:"Measure",children:[{name:"measureDistance"}]}],[{name:"toggleTextSelectionTool"},{name:"eyeTool"},{name:"comment"}]]};function jle(e){var t=this,r=c([]),a=r[0],o=r[1],d=c(""),u=d[0],m=d[1],p=c(""),v=p[0],f=p[1],z=c({pdfEditorToolsToShow:e.toolsToShow||Ble,toolsRelatedData:{},measureToolRelatedData:{scaleIdSelected:"",addNewScaleDetails:_le,editScaleDetails:Dle,distanceAnnotation:{configurationsDrawer:Ile,isFirstPointSelected:!1,isSecondPointSelected:!1}},textHighlightToolRelatedData:{isTextSelectionEnabled:!0,selectedTextToolBoxDetails:{pdfPageId:"",x:0,y:0}}}),g=z[0],y=z[1],M=c(e.currentUserId),E=M[0],b=M[1],H=c([]),V=H[0],C=H[1],L=c([]),k=L[0],w=L[1],S=c(!1),x=S[0],T=S[1],O=c(0),A=O[0],R=O[1],N=c(!1),_=N[0],D=N[1],P=c(!1),F=P[0],I=P[1],B=c(e.areAnnotationsVisibleByDefault),j=B[0],U=B[1],W=c(""),$=W[0],q=W[1],G=c(""),Y=G[0],K=G[1],X=e.rectangleAnnotationToolOptions,Q=e.backendBaseUrl,J=e.rlefEventServiceBaseUrl,Z=i(new Sre({backendBaseUrl:Q})),ee=c(Wie.generateUniqueId()),te=ee[0];ee[1];var ne=c([]),re=ne[0],ae=ne[1],oe=l((function(e){ae((function(t){return Q7(Q7([],t,!0),[e],!1)}))}),[ae]),ce=l((function(e,n){return K7(t,void 0,void 0,(function(){var t,r;return X7(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,3,4]),T(!0),[4,Z.current.fetchUsersOfPdf({pdfId:n,userNameSearchKey:e,limit:10,offset:1})];case 1:return(t=a.sent())&&w(t),[3,4];case 2:return r=a.sent(),console.error("Error fetching suggested users: ",r),[3,4];case 3:return T(!1),[7];case 4:return[2]}}))}))}),[]),ie=l((function(e){ae((function(t){return Q7([],t.filter((function(t){return t!==e})),!0)}))}),[ae]),le=l((function(){return K7(t,void 0,void 0,(function(){var t,n,r,o,c;return X7(this,(function(i){switch(i.label){case 0:if(!(t=(null===(c=a[0])||void 0===c?void 0:c._id)||""))return[2];i.label=1;case 1:return i.trys.push([1,5,,6]),I(!0),[4,Z.current.fetchUsersOfPdf({pdfId:t})];case 2:return(n=i.sent())?-1!==n.findIndex((function(t){return t._id===e.currentUserId}))?[3,4]:[4,Z.current.fetchUsersOfPdf({pdfId:t,userIds:[e.currentUserId]})]:[2];case 3:(r=i.sent())&&r.length>0&&n.push(r[0]),i.label=4;case 4:return C(n),[3,6];case 5:return o=i.sent(),console.error("Error fetching users: ",o),[3,6];case 6:return[2]}}))}))}),[a]);s((function(){F||le()}),[le,F]);var se=c([]);se[0];var he=se[1],de=c({isEditingText:!1,annotationId:"",pdfId:"",pdfPageId:"",color:"",points:[],text:""}),ue=de[0],me=de[1],pe=l((function(e,n){return K7(t,void 0,void 0,(function(){var t,r,a,c,i,l,s,h,d,u,m,p,v;return X7(this,(function(f){switch(f.label){case 0:return t=(n||{}).pdfSourceUrl,e&&oe(e),r={},e&&(r.pdfId=e),t&&(r.pdfSourceUrl=t),a=Z.current.fetchOnlyPdfData(Y7(Y7({},r),{getPdfDownloadUrl:"true"})),c={pdfs:[]},t?[4,a]:[3,6];case 1:return(c=f.sent()).pdfs.length>0?(e=c.pdfs[0]._id,[3,5]):[3,2];case 2:return he((function(e){return Q7(Q7([],e,!0),[t],!1)})),[4,Z.current.insertPdfAndItsPagesInDb({pdfSourceUrl:t,pdfFileName:"sourceUrl.pdf"})];case 3:return i=f.sent(),e=i._id,[4,Z.current.fetchOnlyPdfData(Y7(Y7({},r),{getPdfDownloadUrl:"true"}))];case 4:c=f.sent(),he((function(e){return Q7([],e.filter((function(e){return e!==t})),!0)})),f.label=5;case 5:return[3,8];case 6:return[4,a];case 7:c=f.sent(),f.label=8;case 8:return l=Z.current.fetchOnlyPdfPagesData({pdfId:e,getPdfPageImageDownloadUrl:"true",pdfPageImageUploaded:"true"}),s=Z.current.fetchPdfScales({pdfId:e}),[4,l];case 9:return h=f.sent(),[4,s];case 10:return d=f.sent(),!g.measureToolRelatedData.scaleIdSelected&&d.scales.length>0&&y(Rle((function(e){var t;e.measureToolRelatedData.scaleIdSelected=(null===(t=d.scales[0])||void 0===t?void 0:t._id)||""}))),(u=null===(v=null==c?void 0:c.pdfs[0])||void 0===v?void 0:v.pdfDownloadUrl)?[4,jie(u).promise]:[3,12];case 11:return p=f.sent(),[3,13];case 12:p=null,f.label=13;case 13:return(m=p)&&o((function(n){var r,a,o=Q7([],n,!0),i=o.length>0?o.findIndex((function(t){return t._id===e})):-1,l=-1!==i,s={_id:null===(a=null===(r=null==c?void 0:c.pdfs)||void 0===r?void 0:r[0])||void 0===a?void 0:a._id,sourcePdfUrl:t||"",pdfPagesImageGenerationStatus:c.pdfs[0].pdfPagesImageGenerationStatus,pdfDownloadUrl:c.pdfs[0].pdfDownloadUrl,pdfDocument:m,pages:h.pages.map((function(e){return{_id:null==e?void 0:e._id,pdfId:e.pdfId,annotations:[],commentThreads:[],pageImageUrl:e.pageAsImageDetails.pageImageDownloadUrl||"",pageNumber:e.pageNumber,pdfPageWidthInPoints:e.pdfPageWidthInPoints,pdfPageHeightInPoints:e.pdfPageHeightInPoints,pageAsImageDetails:e.pageAsImageDetails}})),scales:d.scales.map((function(e){return Y7({},e)}))};return l?o[i]=Y7({},s):o.push(s),o})),ie(e),[2]}}))}))}),[oe,Z,ie,o]),ve=l((function(e){y((function(t){var n=Y7({},t);return n.toolsRelatedData=Y7(Y7({},n.toolsRelatedData),{comment:Y7(Y7({},n.toolsRelatedData.comment),{selectedThreadId:e})}),n}))}),[y]),fe=g.measureToolRelatedData.addNewScaleDetails,ze=g.measureToolRelatedData.editScaleDetails,ge=l((function(){return K7(t,void 0,void 0,(function(){return X7(this,(function(e){return y((function(e){var t,n;return Y7(Y7({},e),{measureToolRelatedData:Y7(Y7({},e.measureToolRelatedData),{addNewScaleDetails:Y7(Y7({},e.measureToolRelatedData.addNewScaleDetails),{isAddNewScaleFormPopupOpen:!0,pdfPageId:null===(n=null===(t=null==a?void 0:a[0])||void 0===t?void 0:t.pages[0])||void 0===n?void 0:n._id})})})})),[2]}))}))}),[a]),ye=c([]),Me=ye[0],Ee=ye[1],be=l((function(e){return K7(t,void 0,void 0,(function(){var t,n,r;return X7(this,(function(c){switch(c.label){case 0:return(t=a.find((function(t){return t._id===e.pdfIdOfPage})))&&(n=t.pages.find((function(t){return t._id===e.pdfPageId})))?n.pageImageElement||Me.includes(n._id)?[2]:(Ee((function(e){return Q7(Q7([],e,!0),[n._id],!1)})),[4,xre.downloadImage(n.pageImageUrl)]):[2];case 1:return r=c.sent(),o((function(t){var n=t.map((function(e){return Y7(Y7({},e),{pages:e.pages.map((function(e){return Y7({},e)}))})})),a=n.findIndex((function(t){return t._id===e.pdfIdOfPage})),o=n[a].pages.findIndex((function(t){return t._id===e.pdfPageId}));return n[a].pages[o].pageImageElement=r,n})),Ee((function(e){return Q7([],e.filter((function(e){return e!==n._id})),!0)})),[2]}}))}))}),[Me,a]),He=l((function(e){return K7(t,void 0,void 0,(function(){var t,n,r,c;return X7(this,(function(i){switch(i.label){case 0:return t=e.pdfId,(n=a.find((function(e){return e._id===t})))?(r=n.pages.map((function(e){return e._id})),[4,Z.current.fetchOnlyPdfPagesData({excludePdfPageIds:r,pdfId:t,getPdfPageImageDownloadUrl:"true",pdfPageImageUploaded:"true"})]):[2];case 1:return c=i.sent(),o((function(e){var n=e.findIndex((function(e){return e._id===t}));return-1===n?e:(e[n].pages=Q7(Q7([],e[n].pages,!0),c.pages.map((function(e){return{_id:e._id,pdfId:e.pdfId,pageNumber:e.pageNumber,annotations:[],commentThreads:[],pageAsImageDetails:e.pageAsImageDetails,pageImageUrl:e.pageAsImageDetails.pageImageDownloadUrl||"",pdfPageWidthInPoints:e.pdfPageWidthInPoints,pdfPageHeightInPoints:e.pdfPageHeightInPoints}})),!0),Q7([],e,!0))})),[2]}}))}))}),[a,Z]),Ve=l((function(e){var n=e.pdfId,r=e.pdfPageId,a=e.annotationIds;return K7(t,void 0,void 0,(function(){return X7(this,(function(e){return o((function(e){return e.map((function(e){return e._id===n?Y7(Y7({},e),{pages:e.pages.map((function(e){return e._id===r?Y7(Y7({},e),{annotations:e.annotations.filter((function(e){return!a.includes(e._id)||(Z.current.deletePageAnnotation({annotationId:e._id}),!1)}))}):Y7({},e)}))}):Y7({},e)}))})),[2]}))}))}),[Z]),Ce=l((function(e){var t=e.pdfId,n=e.pdfPageId,r=e.annotations;o((function(e){return e.map((function(e){return e._id===t?Y7(Y7({},e),{pages:e.pages.map((function(e){return e._id===n?Y7(Y7({},e),{annotations:Q7(Q7([],e.annotations,!0),r,!0)}):Y7({pdfPageId:e._id},e)}))}):Y7({},e)}))}))}),[]),Le=c({rectangleAnnotationOptions:X,rectangleAnnotationData:{_id:"",color:"",height:0,width:0,pdfId:"",pdfPageId:"",rotationAngle:0,x:0,y:0},rectangleAnnotationConfigurationDrawer:{isOpen:!1,sections:{color:{collapsedStatus:"collapsed",currentlySelectedColor:""}}}}),ke=Le[0],we=Le[1],Se=h((function(){for(var e=null,t=0,n=a||[];t<n.length;t++)for(var r=0,o=n[t].pages||[];r<o.length;r++)for(var c=0,i=o[r].annotations||[];c<i.length;c++){var l=i[c];if(l._id===u)return l}return e}),[u]);s((function(){(null==Se?void 0:Se.rectangleAnnotation)?we(Rle((function(e){var t;e.rectangleAnnotationConfigurationDrawer.sections.color.currentlySelectedColor=(null===(t=Se.rectangleAnnotation)||void 0===t?void 0:t.color)||""}))):(y(Rle((function(e){e.measureToolRelatedData.distanceAnnotation.configurationsDrawer.isOpen=!1}))),we(Rle((function(e){e.rectangleAnnotationConfigurationDrawer.isOpen=!1}))))}),[Se]);var xe=h((function(){return{pdfs:a,setPdfs:o,annotationSelectedId:u,setAnnotationSelectedId:m,toolSelected:v,setToolSelected:f,tools:g,setTools:y,currentUserId:E,setCurrentUserId:b,users:V,setUsers:C,isLeftBarOpen:_,setIsLeftBarOpen:D,isAnnotationsVisible:j,setIsAnnotationsVisible:U,backendBaseUrl:Q,fetchPdfRelatedData:pe,removeAnnotationsFromPdfPageAndDb:Ve,addAnnotationsToPdfPage:Ce,addPdfPageImageElementIfNotPresentAlready:be,setSelectedCommentThreadId:ve,pageZoomPercentage:A,setPageZoomPercentage:R,rlefEventServiceBaseUrl:J,addNewScaleDetails:fe,addScaleButtonClickedFromToolbar:ge,pdfEditorServiceRef:Z,fetchAndSetPdfPagesInPdfWhichAreCreatedInDB:He,pdfPageIdsForWhichPageImageElementIsBeingFetched:Me,callOutToolRelatedDataWhenSelected:ue,setCallOutToolRelatedDataWhenSelected:me,pdfEditorElementId:te,selectedToolGroup:$,setSelectedToolGroup:q,pdfIdsWhoseDataBeingFetched:re,annotationSelected:Se,editScaleDetails:ze,suggestedUsersForMention:k,fetchAndSetSuggestedUsersForMention:ce,isFetchingSuggestedUsersForMention:x,customCursorToShow:Y,setCustomCursorToShow:K,rectangleRelatedData:ke,setRectangleRelatedData:we}}),[a,u,v,g,E,V,_,j,Q,pe,be,ve,A,R,J,fe,ge,He,Me,ue,te,$,re,Se,ze,k,ce,x,Y,ke]);return n(Ule.Provider,Y7({value:xe},{children:e.children}))}var Ule=a.createContext({}),Wle=function(){var e=a.useContext(Ule);if(!e)throw new Error("usePdfAnnotationContext must be used within a PdfEditorContextProvider");return e};Uie(".ContentArea-module_content-area-container__otXm-{align-items:center;background-color:#e3e6e8;display:flex;flex:1;justify-content:center;overflow:auto;position:relative}");Uie(".PdfPage-module_pageContainer__-Q0sD{display:flex;flex-grow:1;height:100%;width:100%}.PdfPage-module_pageContainerWhenHorizontallyOverflowingAndIsVisibleInViewport__8onR1{align-self:flex-start}.PdfPage-module_justifyContentCenter__-7ATB{justify-content:center}.PdfPage-module_selectedText__m7jFl span::selection{background-color:#ffff0045!important}.PdfPage-module_selectedText__m7jFl span::-moz-selection{background-color:#ffff0045!important}.PdfPage-module_displayNone__cHRJo{display:none}.PdfPage-module_handCursor__vsE7b{cursor:grab!important}.PdfPage-module_handCursor__vsE7b:active{cursor:grabbing!important}");var $le=Math.PI/180;const qle=void 0!==J7?J7:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},Gle={_global:qle,version:"8.4.3",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>Gle.angleDeg?e*$le:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>Gle.DD.isDragging,isDragReady:()=>!!Gle.DD.node,releaseCanvasOnDestroy:!0,document:qle.document,_injectGlobal(e){qle.Konva=e}},Yle=e=>{Gle[e.prototype.getClassName()]=e};Gle._injectGlobal(Gle);class Kle{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Kle(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){var t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,a=this.m[1]*t+this.m[3]*n,o=this.m[0]*-n+this.m[2]*t,c=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=a,this.m[2]=o,this.m[3]=c,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,a=this.m[2]+this.m[0]*e,o=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=a,this.m[3]=o,this}multiply(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],o=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],c=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=a,this.m[4]=o,this.m[5]=c,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,a=this.m[0]*e,o=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),c=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=a,this.m[4]=o,this.m[5]=c,this}getMatrix(){return this.m}decompose(){var e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],a=e*r-t*n;let o={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var c=Math.sqrt(e*e+t*t);o.rotation=t>0?Math.acos(e/c):-Math.acos(e/c),o.scaleX=c,o.scaleY=a/c,o.skewX=(e*n+t*r)/a,o.skewY=0}else if(0!=n||0!=r){var i=Math.sqrt(n*n+r*r);o.rotation=Math.PI/2-(r>0?Math.acos(-n/i):-Math.acos(n/i)),o.scaleX=a/i,o.scaleY=i,o.skewX=0,o.skewY=(e*n+t*r)/a}return o.rotation=rse._getRotation(o.rotation),o}}var Xle=Math.PI/180,Qle=180/Math.PI,Jle="Konva error: ",Zle={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},ese=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,tse=[];const nse="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)},rse={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){tse.push(e),1===tse.length&&nse((function(){const e=tse;tse=[],e.forEach((function(e){e()}))}))},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(e){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var n=rse.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex:(e,t,n)=>((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()|0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB(e){var t;return e in Zle?{r:(t=Zle[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=ese.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",rse._namedColorToRBA(e)||rse._hex3ColorToRGBA(e)||rse._hex4ColorToRGBA(e)||rse._hex6ColorToRGBA(e)||rse._hex8ColorToRGBA(e)||rse._rgbColorToRGBA(e)||rse._rgbaColorToRGBA(e)||rse._hslColorToRGBA(e)),_namedColorToRBA(e){var t=Zle[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e)));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if("#"===e[0]&&9===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if("#"===e[0]&&5===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,a=Number(n[1])/100,o=Number(n[2])/100;let c,i,l;if(0===a)return l=255*o,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};c=o<.5?o*(1+a):o+a-o*a;const s=2*o-c,h=[0,0,0];for(let e=0;e<3;e++)i=r+1/3*-(e-1),i<0&&i++,i>1&&i--,l=6*i<1?s+6*(c-s)*i:2*i<1?c:3*i<2?s+(c-s)*(2/3-i)*6:s,h[e]=255*l;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y),cloneObject(e){var t={};for(var n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray:e=>e.slice(0),degToRad:e=>e*Xle,radToDeg:e=>e*Qle,_degToRad:e=>(rse.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),rse.degToRad(e)),_radToDeg:e=>(rse.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),rse.radToDeg(e)),_getRotation:e=>Gle.angleDeg?rse.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(Jle+e)},error(e){console.error(Jle+e)},warn(e){Gle.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(var n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e<n,_getProjectionToSegment(e,t,n,r,a,o){var c,i,l,s=(e-n)*(e-n)+(t-r)*(t-r);if(0==s)c=e,i=t,l=(a-n)*(a-n)+(o-r)*(o-r);else{var h=((a-e)*(n-e)+(o-t)*(r-t))/s;h<0?(c=e,i=t,l=(e-a)*(e-a)+(t-o)*(t-o)):h>1?(c=n,i=r,l=(n-a)*(n-a)+(r-o)*(r-o)):l=((c=e+h*(n-e))-a)*(c-a)+((i=t+h*(r-t))-o)*(i-o)}return[c,i,l]},_getProjectionToLine(e,t,n){var r=rse.cloneObject(e),a=Number.MAX_VALUE;return t.forEach((function(o,c){if(n||c!==t.length-1){var i=t[(c+1)%t.length],l=rse._getProjectionToSegment(o.x,o.y,i.x,i.y,e.x,e.y),s=l[0],h=l[1],d=l[2];d<a&&(r.x=s,r.y=h,a=d)}})),r},_prepareArrayForTween(e,t,n){var r,a=[],o=[];if(e.length>t.length){var c=t;t=e,e=c}for(r=0;r<e.length;r+=2)a.push({x:e[r],y:e[r+1]});for(r=0;r<t.length;r+=2)o.push({x:t[r],y:t[r+1]});var i=[];return o.forEach((function(e){var t=rse._getProjectionToLine(e,a,n);i.push(t.x),i.push(t.y)})),i},_prepareToStringify(e){var t;for(var n in e.visitedByCircularReferenceRemoval=!0,e)if(e.hasOwnProperty(n)&&e[n]&&"object"==typeof e[n])if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||rse._isElement(e[n])){if(!t.configurable)return null;delete e[n]}else if(null===rse._prepareToStringify(e[n])){if(!t.configurable)return null;delete e[n]}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(var n in t)e[n]=t[n];return e},_getFirstPointerId:e=>e.touches?e.changedTouches[0].identifier:e.pointerId||999,releaseCanvas(...e){Gle.releaseCanvasOnDestroy&&e.forEach((e=>{e.width=0,e.height=0}))},drawRoundedRectPath(e,t,n,r){let a=0,o=0,c=0,i=0;"number"==typeof r?a=o=c=i=Math.min(r,t/2,n/2):(a=Math.min(r[0]||0,t/2,n/2),o=Math.min(r[1]||0,t/2,n/2),i=Math.min(r[2]||0,t/2,n/2),c=Math.min(r[3]||0,t/2,n/2)),e.moveTo(a,0),e.lineTo(t-o,0),e.arc(t-o,o,o,3*Math.PI/2,0,!1),e.lineTo(t,n-i),e.arc(t-i,n-i,i,0,Math.PI/2,!1),e.lineTo(c,n),e.arc(c,n-c,c,Math.PI/2,Math.PI,!1),e.lineTo(0,a),e.arc(a,a,a,Math.PI,3*Math.PI/2,!1)}};function ase(e){return rse._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||rse._isBoolean(e)?e:Object.prototype.toString.call(e)}function ose(e){return e>255?255:e<0?0:Math.round(e)}function cse(){if(Gle.isUnminified)return function(e,t){return rse._isNumber(e)||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function ise(e){if(Gle.isUnminified)return function(t,n){let r=rse._isNumber(t),a=rse._isArray(t)&&t.length==e;return r||a||rse.warn(ase(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function lse(){if(Gle.isUnminified)return function(e,t){return rse._isNumber(e)||"auto"===e||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function sse(){if(Gle.isUnminified)return function(e,t){return rse._isString(e)||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function hse(){if(Gle.isUnminified)return function(e,t){const n=rse._isString(e),r="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||r||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function dse(){if(Gle.isUnminified)return function(e,t){return!0===e||!1===e||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}var use="get",mse="set";const pse={addGetterSetter(e,t,n,r,a){pse.addGetter(e,t,n),pse.addSetter(e,t,r,a),pse.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){var r=use+rse._capitalize(t);e.prototype[r]=e.prototype[r]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter(e,t,n,r){var a=mse+rse._capitalize(t);e.prototype[a]||pse.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){var a=mse+rse._capitalize(t);e.prototype[a]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,a){var o,c,i=n.length,l=rse._capitalize,s=use+l(t),h=mse+l(t);e.prototype[s]=function(){var e={};for(o=0;o<i;o++)e[c=n[o]]=this.getAttr(t+l(c));return e};var d=function(e){if(Gle.isUnminified)return function(t,n){return null==t||rse.isObject(t)||rse.warn(ase(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}(n);e.prototype[h]=function(e){var o,c=this.attrs[t];for(o in r&&(e=r.call(this,e)),d&&d.call(this,e,t),e)e.hasOwnProperty(o)&&this._setAttr(t+l(o),e[o]);return e||n.forEach((e=>{this._setAttr(t+l(e),void 0)})),this._fireChangeEvent(t,c,e),a&&a.call(this),this},pse.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){var n=rse._capitalize(t),r=mse+n,a=use+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[a]()}},addDeprecatedGetterSetter(e,t,n,r){rse.error("Adding deprecated "+t);var a=use+rse._capitalize(t),o=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[a]=function(){rse.error(o);var e=this.attrs[t];return void 0===e?n:e},pse.addSetter(e,t,r,(function(){rse.error(o)})),pse.addOverloadedGetterSetter(e,t)},backCompat(e,t){rse.each(t,(function(t,n){var r=e.prototype[n],a=use+rse._capitalize(t),o=mse+rse._capitalize(t);function c(){r.apply(this,arguments),rse.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=c,e.prototype[a]=c,e.prototype[o]=c}))},afterSetFilter(){this._filterUpToDate=!1}};var vse,fse=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class zse{constructor(e){this.canvas=e,Gle.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){var n,r,a,o,c=this.traceArr,i=c.length,l="";for(n=0;n<i;n++)(a=(r=c[n]).method)?(o=r.args,l+=a,e?l+="()":rse._isArray(o[0])?l+="(["+o.join(",")+"])":(t&&(o=o.map((e=>"number"==typeof e?Math.floor(e):e))),l+="("+o.join(",")+")")):(l+=r.property,e||(l+="="+r.val)),l+=";";return l}clearTrace(){this.traceArr=[]}_trace(e){var t=this.traceArr;t.push(e),t.length>=100&&t.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,a,o){this._context.arc(e,t,n,r,a,o)}arcTo(e,t,n,r,a){this._context.arcTo(e,t,n,r,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,a,o){this._context.bezierCurveTo(e,t,n,r,a,o)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,a,o){return this._context.createRadialGradient(e,t,n,r,a,o)}drawImage(e,t,n,r,a,o,c,i,l){var s=arguments,h=this._context;3===s.length?h.drawImage(e,t,n):5===s.length?h.drawImage(e,t,n,r,a):9===s.length&&h.drawImage(e,t,n,r,a,o,c,i,l)}ellipse(e,t,n,r,a,o,c,i){this._context.ellipse(e,t,n,r,a,o,c,i)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,a,o){this._context.setTransform(e,t,n,r,a,o)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,a,o){this._context.transform(e,t,n,r,a,o)}translate(e,t){this._context.translate(e,t)}_enableTrace(){var e,t,n=this,r=fse.length,a=this.setAttr,o=function(e){var r,a=n[e];n[e]=function(){return t=function(e){var t,n,r=[],a=e.length,o=rse;for(t=0;t<a;t++)n=e[t],o._isNumber(n)?n=Math.round(1e3*n)/1e3:o._isString(n)||(n+=""),r.push(n);return r}(Array.prototype.slice.call(arguments,0)),r=a.apply(n,arguments),n._trace({method:e,args:t}),r}};for(e=0;e<r;e++)o(fse[e]);n.setAttr=function(){a.apply(n,arguments);var e=arguments[0],t=arguments[1];"shadowOffsetX"!==e&&"shadowOffsetY"!==e&&"shadowBlur"!==e||(t/=this.canvas.getPixelRatio()),n._trace({property:e,val:t})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||"source-over"===t||this.setAttr("globalCompositeOperation",t)}}["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach((function(e){Object.defineProperty(zse.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})}));class gse extends zse{constructor(e){super(e),this._context=e._canvas.getContext("2d")}_fillColor(e){var t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){const t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){const t=e.fill(),n=e.getFillPriority();if(t&&"color"===n)return void this._fillColor(e);const r=e.getFillPatternImage();if(r&&"pattern"===n)return void this._fillPattern(e);const a=e.getFillLinearGradientColorStops();if(a&&"linear-gradient"===n)return void this._fillLinearGradient(e);const o=e.getFillRadialGradientColorStops();o&&"radial-gradient"===n?this._fillRadialGradient(e):t?this._fillColor(e):r?this._fillPattern(e):a?this._fillLinearGradient(e):o&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(var o=0;o<r.length;o+=2)a.addColorStop(r[o],r[o+1]);this.setAttr("strokeStyle",a)}}_stroke(e){var t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r,a=null!==(t=e.getShadowRGBA())&&void 0!==t?t:"black",o=null!==(n=e.getShadowBlur())&&void 0!==n?n:5,c=null!==(r=e.getShadowOffset())&&void 0!==r?r:{x:0,y:0},i=e.getAbsoluteScale(),l=this.canvas.getPixelRatio(),s=i.x*l,h=i.y*l;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",o*Math.min(Math.abs(s),Math.abs(h))),this.setAttr("shadowOffsetX",c.x*s),this.setAttr("shadowOffsetY",c.y*h)}}class yse extends zse{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const a=e.getStrokeScaleEnabled();if(!a){this.save();var t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(e);var n=e.hitStrokeWidth(),r="auto"===n?e.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),a||this.restore()}}}class Mse{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var t=(e||{}).pixelRatio||Gle.pixelRatio||function(){if(vse)return vse;var e=rse.createCanvasElement(),t=e.getContext("2d");return vse=(Gle._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),rse.releaseCanvas(e),vse}();this.pixelRatio=t,this._canvas=rse.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){var t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch(e){try{return this._canvas.toDataURL()}catch(e){return rse.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}pse.addGetterSetter(Mse,"pixelRatio",void 0,cse());class Ese extends Mse{constructor(e={width:0,height:0}){super(e),this.context=new gse(this),this.setSize(e.width,e.height)}}class bse extends Mse{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new yse(this),this.setSize(e.width,e.height)}}const Hse={get isDragging(){var e=!1;return Hse._dragElements.forEach((t=>{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){var e;return Hse._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const t=[];Hse._dragElements.forEach(((n,r)=>{const{node:a}=n,o=a.getStage();o.setPointersPositions(e),void 0===n.pointerId&&(n.pointerId=rse._getFirstPointerId(e));const c=o._changedPointerPositions.find((e=>e.id===n.pointerId));if(c){if("dragging"!==n.dragStatus){var i=a.dragDistance();if(Math.max(Math.abs(c.x-n.startPointerPos.x),Math.abs(c.y-n.startPointerPos.y))<i)return;if(a.startDrag({evt:e}),!a.isDragging())return}a._setDragPosition(e,n),t.push(a)}})),t.forEach((t=>{t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(e){const t=[];Hse._dragElements.forEach((n=>{const{node:r}=n,a=r.getStage();if(e&&a.setPointersPositions(e),!a._changedPointerPositions.find((e=>e.id===n.pointerId)))return;"dragging"!==n.dragStatus&&"stopped"!==n.dragStatus||(Hse.justDragged=!0,Gle._mouseListenClick=!1,Gle._touchListenClick=!1,Gle._pointerListenClick=!1,n.dragStatus="stopped");const o=n.node.getLayer()||n.node instanceof Gle.Stage&&n.node;o&&-1===t.indexOf(o)&&t.push(o)})),t.forEach((e=>{e.draw()}))},_endDragAfter(e){Hse._dragElements.forEach(((t,n)=>{"stopped"===t.dragStatus&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),"dragging"!==t.dragStatus&&Hse._dragElements.delete(n)}))}};Gle.isBrowser&&(window.addEventListener("mouseup",Hse._endDragBefore,!0),window.addEventListener("touchend",Hse._endDragBefore,!0),window.addEventListener("mousemove",Hse._drag),window.addEventListener("touchmove",Hse._drag),window.addEventListener("mouseup",Hse._endDragAfter,!1),window.addEventListener("touchend",Hse._endDragAfter,!1));var Vse="absoluteOpacity",Cse="allEventListeners",Lse="absoluteTransform",kse="absoluteScale",wse="canvas",Sse="listening",xse="mouseenter",Tse="mouseleave",Ose="Shape",Ase=" ",Rse="stage",Nse="transform",_se="visible",Dse=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Ase);let Pse=1;class Fse{constructor(e){this._id=Pse++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==Nse&&e!==Lse||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){var n=this._cache.get(e);return(void 0===n||(e===Nse||e===Lse)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map((e=>e+"Change.konva")).join(Ase);this.on(n,(()=>{this._clearCache(e)})),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(wse)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Lse&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(wse)){const{scene:e,filter:t,hit:n}=this._cache.get(wse);rse.releaseCanvas(e,t,n),this._cache.delete(wse)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var t=e||{},n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var r=Math.ceil(t.width||n.width),a=Math.ceil(t.height||n.height),o=t.pixelRatio,c=void 0===t.x?Math.floor(n.x):t.x,i=void 0===t.y?Math.floor(n.y):t.y,l=t.offset||0,s=t.drawBorder||!1,h=t.hitCanvasPixelRatio||1;if(r&&a){c-=l,i-=l;var d=new Ese({pixelRatio:o,width:r+=2*l+1,height:a+=2*l+1}),u=new Ese({pixelRatio:o,width:0,height:0}),m=new bse({pixelRatio:h,width:r,height:a}),p=d.getContext(),v=m.getContext();return m.isCache=!0,d.isCache=!0,this._cache.delete(wse),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(d.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),p.save(),v.save(),p.translate(-c,-i),v.translate(-c,-i),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Vse),this._clearSelfAndDescendantCache(kse),this.drawScene(d,this),this.drawHit(m,this),this._isUnderCache=!1,p.restore(),v.restore(),s&&(p.save(),p.beginPath(),p.rect(0,0,r,a),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(wse,{scene:d,filter:u,hit:m,x:c,y:i}),this._requestDraw(),this}rse.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(wse)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){var n,r,a,o,c=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],i=this.getAbsoluteTransform(t);return c.forEach((function(e){var t=i.point(e);void 0===n&&(n=a=t.x,r=o=t.y),n=Math.min(n,t.x),r=Math.min(r,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y)})),{x:n,y:r,width:a-n,height:o-r}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){var t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e,t,n,r,a=this.filters(),o=this._getCanvasCache(),c=o.scene,i=o.filter,l=i.getContext();if(a){if(!this._filterUpToDate){var s=c.pixelRatio;i.setSize(c.width/c.pixelRatio,c.height/c.pixelRatio);try{for(e=a.length,l.clear(),l.drawImage(c._canvas,0,0,c.getWidth()/s,c.getHeight()/s),t=l.getImageData(0,0,i.getWidth(),i.getHeight()),n=0;n<e;n++)"function"==typeof(r=a[n])?(r.call(this,t),l.putImageData(t,0,0)):rse.error("Filter should be type of function, but got "+typeof r+" instead. Please check correct filters")}catch(e){rse.error("Unable to apply filter. "+e.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return i}return c}on(e,t){if(this._cache&&this._cache.delete(Cse),3===arguments.length)return this._delegate.apply(this,arguments);var n,r,a,o,c=e.split(Ase),i=c.length;for(n=0;n<i;n++)a=(r=c[n].split("."))[0],o=r[1]||"",this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:o,handler:t});return this}off(e,t){var n,r,a,o,c,i=(e||"").split(Ase),l=i.length;if(this._cache&&this._cache.delete(Cse),!e)for(r in this.eventListeners)this._off(r);for(n=0;n<l;n++)if(o=(a=i[n].split("."))[0],c=a[1],o)this.eventListeners[o]&&this._off(o,c,t);else for(r in this.eventListeners)this._off(r,c,t);return this}dispatchEvent(e){var t={target:this,type:e.type,evt:e};return this.fire(e.type,t),this}addEventListener(e,t){return this.on(e,(function(e){t.call(this,e.evt)})),this}removeEventListener(e){return this.off(e),this}_delegate(e,t,n){var r=this;this.on(e,(function(e){for(var a=e.target.findAncestors(t,!0,r),o=0;o<a.length;o++)(e=rse.cloneObject(e)).currentTarget=a[o],n.call(a[o],e)}))}remove(){return this.isDragging()&&this.stopDrag(),Hse._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Lse),this._clearSelfAndDescendantCache(Vse),this._clearSelfAndDescendantCache(kse),this._clearSelfAndDescendantCache(Rse),this._clearSelfAndDescendantCache(_se),this._clearSelfAndDescendantCache(Sse)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){var t="get"+rse._capitalize(e);return rse._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),t=[];e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges((()=>{var t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+rse._capitalize(t),rse._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))})),this}isListening(){return this._getCache(Sse,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(_se,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),r=!1;Hse._dragElements.forEach((e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(r=!0)}));var a=!t&&!Gle.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e,t,n,r,a=this.getDepth(),o=this,c=0;return"Stage"!==o.nodeType&&function i(l){for(e=[],t=l.length,n=0;n<t;n++)r=l[n],c++,r.nodeType!==Ose&&(e=e.concat(r.getChildren().slice())),r._id===o._id&&(n=t);e.length>0&&e[0].getDepth()<=a&&i(e)}(o.getStage().getChildren()),c}getDepth(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Nse),this._clearSelfAndDescendantCache(Lse)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges((()=>{this.x(e.x),this.y(e.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(e)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var r=this.getAbsoluteTransform(e).getMatrix(),a=new Kle,o=this.offset();return a.m=r.slice(),a.translate(o.x,o.y),a.getTranslation()}setAbsolutePosition(e){var t=this._clearTransform();this.attrs.x=t.x,this.attrs.y=t.y,delete t.x,delete t.y,this._clearCache(Nse);var n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(e.x,e.y),e={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(t),this.setPosition({x:e.x,y:e.y}),this._clearCache(Nse),this._clearSelfAndDescendantCache(Lse),this}_setTransform(e){var t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var t=e.x,n=e.y,r=this.x(),a=this.y();return void 0!==t&&(r+=t),void 0!==n&&(a+=n),this.setPosition({x:r,y:a}),this}_eachAncestorReverse(e,t){var n,r,a=[],o=this.getParent();if(!t||t._id!==this._id){for(a.unshift(this);o&&(!t||o._id!==t._id);)a.unshift(o),o=o.parent;for(n=a.length,r=0;r<n;r++)e(a[r])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return rse.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return rse.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return rse.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return rse.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return rse.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&rse.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Vse,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e,t,n,r,a={},o=this.getAttrs();for(e in a.attrs={},o)t=o[e],rse.isObject(t)&&!rse._isPlainObject(t)&&!rse._isArray(t)||(n="function"==typeof this[e]&&this[e],delete o[e],r=n?n.call(this):null,o[e]=t,r!==t&&(a.attrs[e]=t));return a.className=this.getClassName(),rse._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){var r=[];t&&this._isMatch(e)&&r.push(this);for(var a=this.parent;a;){if(a===n)return r;a._isMatch(e)&&r.push(a),a=a.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var t,n,r=e.replace(/ /g,"").split(","),a=r.length;for(t=0;t<a;t++)if(n=r[t],rse.isValidSelector(n)||(rse.warn('Selector "'+n+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),rse.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),rse.warn("Konva is awesome, right?")),"#"===n.charAt(0)){if(this.id()===n.slice(1))return!0}else if("."===n.charAt(0)){if(this.hasName(n.slice(1)))return!0}else if(this.className===n||this.nodeType===n)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(Rse,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():void 0}fire(e,t={},n){return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Lse,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var t;if(e)return t=new Kle,this._eachAncestorReverse((function(e){var n=e.transformsEnabled();"all"===n?t.multiply(e.getTransform()):"position"===n&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())}),e),t;t=this._cache.get(Lse)||new Kle,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();var n=this.transformsEnabled();if("all"===n)t.multiply(this.getTransform());else if("position"===n){const e=this.attrs.x||0,n=this.attrs.y||0,r=this.attrs.offsetX||0,a=this.attrs.offsetY||0;t.translate(e-r,n-a)}return t.dirty=!1,t}getAbsoluteScale(e){for(var t=this;t;)t._isUnderCache&&(e=t),t=t.getParent();const n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Nse,this._getTransform)}_getTransform(){var e,t,n=this._cache.get(Nse)||new Kle;n.reset();var r=this.x(),a=this.y(),o=Gle.getAngle(this.rotation()),c=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,i=null!==(t=this.attrs.scaleY)&&void 0!==t?t:1,l=this.attrs.skewX||0,s=this.attrs.skewY||0,h=this.attrs.offsetX||0,d=this.attrs.offsetY||0;return 0===r&&0===a||n.translate(r,a),0!==o&&n.rotate(o),0===l&&0===s||n.skew(l,s),1===c&&1===i||n.scale(c,i),0===h&&0===d||n.translate(-1*h,-1*d),n.dirty=!1,n}clone(e){var t,n,r,a,o,c=rse.cloneObject(this.attrs);for(t in e)c[t]=e[t];var i=new this.constructor(c);for(t in this.eventListeners)for(r=(n=this.eventListeners[t]).length,a=0;a<r;a++)(o=n[a]).name.indexOf("konva")<0&&(i.eventListeners[t]||(i.eventListeners[t]=[]),i.eventListeners[t].push(o));return i}_toKonvaCanvas(e){e=e||{};var t=this.getClientRect(),n=this.getStage(),r=void 0!==e.x?e.x:Math.floor(t.x),a=void 0!==e.y?e.y:Math.floor(t.y),o=e.pixelRatio||1,c=new Ese({width:e.width||Math.ceil(t.width)||(n?n.width():0),height:e.height||Math.ceil(t.height)||(n?n.height():0),pixelRatio:o}),i=c.getContext();return!1===e.imageSmoothingEnabled&&(i._context.imageSmoothingEnabled=!1),i.save(),(r||a)&&i.translate(-1*r,-1*a),this.drawScene(c),i.restore(),c}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){var t=(e=e||{}).mimeType||null,n=e.quality||null,r=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(r),r}toImage(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,rse._urlToImage(this.toDataURL(e),(function(e){t(e),null==n||n(e)}))}catch(e){n(e)}}))}toBlob(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob((e=>{t(e),null==n||n(e)}))}catch(e){n(e)}}))}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Gle.dragDistance}_off(e,t,n){var r,a,o,c=this.eventListeners[e];for(r=0;r<c.length;r++)if(a=c[r].name,o=c[r].handler,!("konva"===a&&"konva"!==t||t&&a!==t||n&&n!==o)){if(c.splice(r,1),0===c.length){delete this.eventListeners[e];break}r--}}_fireChangeEvent(e,t,n){this._fire(e+"Change",{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){var t=this.name(),n=t?t+" "+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;const t=this.name();return!!t&&-1!==(t||"").split(/\s/g).indexOf(e)}removeName(e){var t=(this.name()||"").split(/\s/g),n=t.indexOf(e);return-1!==n&&(t.splice(n,1),this.name(t.join(" "))),this}setAttr(e,t){var n=this["set"+rse._capitalize(e)];return rse._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){if(Gle.autoDrawEnabled){const e=this.getLayer()||this.getStage();null==e||e.batchDraw()}}_setAttr(e,t){var n=this.attrs[e];(n!==t||rse.isObject(t))&&(null==t?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){var r;void 0!==n&&((r=this.attrs[e])||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,r,n))}_fireAndBubble(e,t,n){if(t&&this.nodeType===Ose&&(t.target=this),e!==xse&&e!==Tse||!(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||"Stage"===this.nodeType&&!n)){this._fire(e,t);var r=(e===xse||e===Tse)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(t&&!t.cancelBubble||!t)&&this.parent&&this.parent.isListening()&&!r&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,t,n):this._fireAndBubble.call(this.parent,e,t))}}_getProtoListeners(e){let t=this._cache.get(Cse);if(!t){t={};let e=Object.getPrototypeOf(this);for(;e;)if(e.eventListeners){for(var n in e.eventListeners){const r=e.eventListeners[n],a=t[n]||[];t[n]=r.concat(a)}e=Object.getPrototypeOf(e)}else e=Object.getPrototypeOf(e);this._cache.set(Cse,t)}return t[e]}_fire(e,t){(t=t||{}).currentTarget=this,t.type=e;const n=this._getProtoListeners(e);if(n)for(var r=0;r<n.length;r++)n[r].handler.call(this,t);const a=this.eventListeners[e];if(a)for(r=0;r<a.length;r++)a[r].handler.call(this,t)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var t=e?e.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition(),a=n._getPointerById(t)||n._changedPointerPositions[0]||r;Hse._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-r.x,y:a.y-r.y},dragStatus:"ready",pointerId:t})}startDrag(e,t=!0){Hse._dragElements.has(this._id)||this._createDragElement(e),Hse._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},t)}_setDragPosition(e,t){const n=this.getStage()._getPointerById(t.pointerId);if(n){var r={x:n.x-t.offset.x,y:n.y-t.offset.y},a=this.dragBoundFunc();if(void 0!==a){const t=a.call(this,r,e);t?r=t:rse.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(e){const t=Hse._dragElements.get(this._id);t&&(t.dragStatus="stopped"),Hse._endDragBefore(e),Hse._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=Hse._dragElements.get(this._id);return!!e&&"dragging"===e.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(e){if((void 0===e.evt.button||Gle.dragButtons.indexOf(e.evt.button)>=0)&&!this.isDragging()){var t=!1;Hse._dragElements.forEach((e=>{this.isAncestorOf(e.node)&&(t=!0)})),t||this._createDragElement(e)}}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=Hse._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&Hse._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return rse.haveIntersection(n,this.getClientRect())}static create(e,t){return rse._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){var n,r,a,o=Fse.prototype.getClassName.call(e),c=e.children;if(t&&(e.attrs.container=t),Gle[o]||(rse.warn('Can not find a node with class name "'+o+'". Fallback to "Shape".'),o="Shape"),n=new Gle[o](e.attrs),c)for(r=c.length,a=0;a<r;a++)n.add(Fse._createNode(c[a]));return n}}Fse.prototype.nodeType="Node",Fse.prototype._attrsAffectingSize=[],Fse.prototype.eventListeners={},Fse.prototype.on.call(Fse.prototype,Dse,(function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(Nse),this._clearSelfAndDescendantCache(Lse))})),Fse.prototype.on.call(Fse.prototype,"visibleChange.konva",(function(){this._clearSelfAndDescendantCache(_se)})),Fse.prototype.on.call(Fse.prototype,"listeningChange.konva",(function(){this._clearSelfAndDescendantCache(Sse)})),Fse.prototype.on.call(Fse.prototype,"opacityChange.konva",(function(){this._clearSelfAndDescendantCache(Vse)}));const Ise=pse.addGetterSetter;Ise(Fse,"zIndex"),Ise(Fse,"absolutePosition"),Ise(Fse,"position"),Ise(Fse,"x",0,cse()),Ise(Fse,"y",0,cse()),Ise(Fse,"globalCompositeOperation","source-over",sse()),Ise(Fse,"opacity",1,cse()),Ise(Fse,"name","",sse()),Ise(Fse,"id","",sse()),Ise(Fse,"rotation",0,cse()),pse.addComponentsGetterSetter(Fse,"scale",["x","y"]),Ise(Fse,"scaleX",1,cse()),Ise(Fse,"scaleY",1,cse()),pse.addComponentsGetterSetter(Fse,"skew",["x","y"]),Ise(Fse,"skewX",0,cse()),Ise(Fse,"skewY",0,cse()),pse.addComponentsGetterSetter(Fse,"offset",["x","y"]),Ise(Fse,"offsetX",0,cse()),Ise(Fse,"offsetY",0,cse()),Ise(Fse,"dragDistance",null,cse()),Ise(Fse,"width",0,cse()),Ise(Fse,"height",0,cse()),Ise(Fse,"listening",!0,dse()),Ise(Fse,"preventDefault",!0,dse()),Ise(Fse,"filters",null,(function(e){return this._filterUpToDate=!1,e})),Ise(Fse,"visible",!0,dse()),Ise(Fse,"transformsEnabled","all",sse()),Ise(Fse,"size"),Ise(Fse,"dragBoundFunc"),Ise(Fse,"draggable",!1,dse()),pse.backCompat(Fse,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Bse extends Fse{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const t=this.children||[];var n=[];return t.forEach((function(t){e(t)&&n.push(t)})),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.destroy()})),this.children=[],this._requestDraw(),this}add(...e){if(0===e.length)return this;if(e.length>1){for(var t=0;t<e.length;t++)this.add(e[t]);return this}const n=e[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){var n=[];return this._descendants((r=>{const a=r._isMatch(e);return a&&n.push(r),!(!a||!t)})),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){var e=Fse.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((t=>{e.children.push(t.toObject())})),e}isAncestorOf(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){var t=Fse.prototype.clone.call(this,e);return this.getChildren().forEach((function(e){t.add(e.clone())})),t}getAllIntersections(e){var t=[];return this.find("Shape").forEach((function(n){n.isVisible()&&n.intersects(e)&&t.push(n)})),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach((function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach((function(e,t){e.index=t})),this._requestDraw()}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas(),a=r&&r.getContext(),o=this._getCanvasCache(),c=o&&o.scene,i=r&&r.isCache;if(!this.isVisible()&&!i)return this;if(c){a.save();var l=this.getAbsoluteTransform(t).getMatrix();a.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",r,t);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),r=e||n&&n.hitCanvas,a=r&&r.getContext(),o=this._getCanvasCache();if(o&&o.hit){a.save();var c=this.getAbsoluteTransform(t).getMatrix();a.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n){var r,a=t&&t.getContext(),o=this.clipWidth(),c=this.clipHeight(),i=this.clipFunc(),l=o&&c||i;const s=n===this;if(l){a.save();var h=this.getAbsoluteTransform(n),d=h.getMatrix();if(a.transform(d[0],d[1],d[2],d[3],d[4],d[5]),a.beginPath(),i)i.call(this,a,this);else{var u=this.clipX(),m=this.clipY();a.rect(u,m,o,c)}a.clip(),d=h.copy().invert().getMatrix(),a.transform(d[0],d[1],d[2],d[3],d[4],d[5])}var p=!s&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;p&&(a.save(),a._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[e](t,n)})),p&&a.restore(),l&&a.restore()}getClientRect(e){var t,n,r,a,o,c,i=(e=e||{}).skipTransform,l=e.relativeTo,s=this;null===(t=this.children)||void 0===t||t.forEach((function(t){if(t.visible()){var c=t.getClientRect({relativeTo:s,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===c.width&&0===c.height||(void 0===n?(n=c.x,r=c.y,a=c.x+c.width,o=c.y+c.height):(n=Math.min(n,c.x),r=Math.min(r,c.y),a=Math.max(a,c.x+c.width),o=Math.max(o,c.y+c.height)))}}));for(var h=this.find("Shape"),d=!1,u=0;u<h.length;u++)if(h[u]._isVisible(this)){d=!0;break}return c=d&&void 0!==n?{x:n,y:r,width:a-n,height:o-r}:{x:0,y:0,width:0,height:0},i?c:this._transformedRect(c,l)}}pse.addComponentsGetterSetter(Bse,"clip",["x","y","width","height"]),pse.addGetterSetter(Bse,"clipX",void 0,cse()),pse.addGetterSetter(Bse,"clipY",void 0,cse()),pse.addGetterSetter(Bse,"clipWidth",void 0,cse()),pse.addGetterSetter(Bse,"clipHeight",void 0,cse()),pse.addGetterSetter(Bse,"clipFunc");const jse=new Map,Use=void 0!==Gle._global.PointerEvent;function Wse(e){return jse.get(e)}function $se(e){return{evt:e,pointerId:e.pointerId}}function qse(e,t){return jse.get(e)===t}function Gse(e,t){Yse(e),t.getStage()&&(jse.set(e,t),Use&&t._fire("gotpointercapture",$se(new PointerEvent("gotpointercapture"))))}function Yse(e,t){const n=jse.get(e);if(!n)return;const r=n.getStage();r&&r.content,jse.delete(e),Use&&n._fire("lostpointercapture",$se(new PointerEvent("lostpointercapture")))}var Kse="mouseleave",Xse="mouseover",Qse="mouseenter",Jse="mousemove",Zse="mousedown",ehe="mouseup",the="pointermove",nhe="pointerdown",rhe="pointerup",ahe="pointercancel",ohe="pointerout",che="pointerleave",ihe="pointerover",lhe="pointerenter",she="contextmenu",hhe="touchstart",dhe="touchend",uhe="touchmove",mhe="touchcancel",phe="wheel",vhe=[[Qse,"_pointerenter"],[Zse,"_pointerdown"],[Jse,"_pointermove"],[ehe,"_pointerup"],[Kse,"_pointerleave"],[hhe,"_pointerdown"],[uhe,"_pointermove"],[dhe,"_pointerup"],[mhe,"_pointercancel"],[Xse,"_pointerover"],[phe,"_wheel"],[she,"_contextmenu"],[nhe,"_pointerdown"],[the,"_pointermove"],[rhe,"_pointerup"],[ahe,"_pointercancel"],["lostpointercapture","_lostpointercapture"]];const fhe={mouse:{[ohe]:"mouseout",[che]:Kse,[ihe]:Xse,[lhe]:Qse,[the]:Jse,[nhe]:Zse,[rhe]:ehe,[ahe]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[ohe]:"touchout",[che]:"touchleave",[ihe]:"touchover",[lhe]:"touchenter",[the]:uhe,[nhe]:hhe,[rhe]:dhe,[ahe]:mhe,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[ohe]:ohe,[che]:che,[ihe]:ihe,[lhe]:lhe,[the]:the,[nhe]:nhe,[rhe]:rhe,[ahe]:ahe,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},zhe=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",ghe=e=>{const t=zhe(e);return"pointer"===t?Gle.pointerEventsEnabled&&fhe.pointer:"touch"===t?fhe.touch:"mouse"===t?fhe.mouse:void 0};function yhe(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&rse.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const Mhe=[];class Ehe extends Bse{constructor(e){super(yhe(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Mhe.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(()=>{yhe(this.attrs)})),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||rse.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e,t=this.children,n=t.length;for(e=0;e<n;e++)t[e].clear();return this}clone(e){return e||(e={}),e.container="undefined"!=typeof document&&document.createElement("div"),Bse.prototype.clone.call(this,e)}destroy(){super.destroy();var e=this.content;e&&rse._isInDocument(e)&&this.container().removeChild(e);var t=Mhe.indexOf(this);return t>-1&&Mhe.splice(t,1),rse.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(rse.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(e){return this._pointerPositions.find((t=>t.id===e))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new Ese({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach((function(t){if(t.isVisible()){var r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),t}getIntersection(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){const r=n[t].getIntersection(e);if(r)return r}return null}_resizeDOM(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach((n=>{n.setSize({width:e,height:t}),n.draw()}))}add(e,...t){if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}super.add(e);var r=this.children.length;return r>5&&rse.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),Gle.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return qse(e,this)}setPointerCapture(e){Gse(e,this)}releaseCapture(e){Yse(e)}getLayers(){return this.children}_bindContentEvents(){Gle.isBrowser&&vhe.forEach((([e,t])=>{this.content.addEventListener(e,(e=>{this[t](e)}),{passive:!1})}))}_pointerenter(e){this.setPointersPositions(e);const t=ghe(e.type);this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=ghe(e.type);this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=ghe(e.type),n=zhe(e.type);if(t){this.setPointersPositions(e);var r=this._getTargetShape(n),a=!Hse.isDragging||Gle.hitOnDragEnabled;r&&a?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):a&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const t=ghe(e.type),n=zhe(e.type);if(t){this.setPointersPositions(e);var r=!1;this._changedPointerPositions.forEach((a=>{var o=this.getIntersection(a);if(Hse.justDragged=!1,Gle["_"+n+"ListenClick"]=!0,!o||!o.isListening())return;Gle.capturePointerEventsEnabled&&o.setPointerCapture(a.id),this[n+"ClickStartShape"]=o,o._fireAndBubble(t.pointerdown,{evt:e,pointerId:a.id}),r=!0;const c=e.type.indexOf("touch")>=0;o.preventDefault()&&e.cancelable&&c&&e.preventDefault()})),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const t=ghe(e.type),n=zhe(e.type);if(!t)return;if(Hse.isDragging&&Hse.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),Hse.isDragging&&!Gle.hitOnDragEnabled)return;var r={};let a=!1;var o=this._getTargetShape(n);this._changedPointerPositions.forEach((c=>{const i=Wse(c.id)||this.getIntersection(c),l=c.id,s={evt:e,pointerId:l};var h=o!==i;if(h&&o&&(o._fireAndBubble(t.pointerout,Object.assign({},s),i),o._fireAndBubble(t.pointerleave,Object.assign({},s),i)),i){if(r[i._id])return;r[i._id]=!0}i&&i.isListening()?(a=!0,h&&(i._fireAndBubble(t.pointerover,Object.assign({},s),o),i._fireAndBubble(t.pointerenter,Object.assign({},s),o),this[n+"targetShape"]=i),i._fireAndBubble(t.pointermove,Object.assign({},s))):o&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:l}),this[n+"targetShape"]=null)})),a||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=ghe(e.type),n=zhe(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],a=this[n+"ClickEndShape"];var o={};let c=!1;this._changedPointerPositions.forEach((i=>{const l=Wse(i.id)||this.getIntersection(i);if(l){if(l.releaseCapture(i.id),o[l._id])return;o[l._id]=!0}const s=i.id,h={evt:e,pointerId:s};let d=!1;Gle["_"+n+"InDblClickWindow"]?(d=!0,clearTimeout(this[n+"DblTimeout"])):Hse.justDragged||(Gle["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){Gle["_"+n+"InDblClickWindow"]=!1}),Gle.dblClickWindow),l&&l.isListening()?(c=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,Object.assign({},h)),Gle["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,Object.assign({},h)),d&&a&&a===l&&l._fireAndBubble(t.pointerdblclick,Object.assign({},h)))):(this[n+"ClickEndShape"]=null,Gle["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:s}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:s}))})),c||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),Gle["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(she,{evt:e}):this._fire(she,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(phe,{evt:e}):this._fire(phe,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=Wse(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(rhe,$se(e)),Yse(e.pointerId)}_lostpointercapture(e){Yse(e.pointerId)}setPointersPositions(e){var t=this._getContentPosition(),n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})),Array.prototype.forEach.call(e.changedTouches||e.touches,(e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:rse._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:rse._getFirstPointerId(e)}])}_setPointerPosition(e){rse.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ese({width:this.width(),height:this.height()}),this.bufferHitCanvas=new bse({pixelRatio:1,width:this.width(),height:this.height()}),Gle.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}cache(){return rse.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(e){e.batchDraw()})),this}}Ehe.prototype.nodeType="Stage",Yle(Ehe),pse.addGetterSetter(Ehe,"container");var bhe="hasShadow",Hhe="shadowRGBA",Vhe="patternImage",Che="linearGradient",Lhe="radialGradient";let khe;function whe(){return khe||(khe=rse.createCanvasElement().getContext("2d"),khe)}const She={};class xhe extends Fse{constructor(e){let t;for(super(e);t=rse.getRandomColor(),!t||t in She;);this.colorKey=t,She[t]=this}getContext(){return rse.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return rse.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(bhe,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Vhe,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=whe().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new Kle;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(Gle.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Che,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var t=whe(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),a=t.createLinearGradient(n.x,n.y,r.x,r.y),o=0;o<e.length;o+=2)a.addColorStop(e[o],e[o+1]);return a}}_getRadialGradient(){return this._getCache(Lhe,this.__getRadialGradient)}__getRadialGradient(){var e=this.fillRadialGradientColorStops();if(e){for(var t=whe(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),a=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius()),o=0;o<e.length;o+=2)a.addColorStop(e[o],e[o+1]);return a}}getShadowRGBA(){return this._getCache(Hhe,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var e=rse.colorToRGBA(this.shadowColor());return e?"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")":void 0}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],(()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var t=this.getStage().bufferHitCanvas;return t.getContext().clear(),this.drawHit(t,null,!0),t.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return Fse.prototype.destroy.call(this),delete She[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!this.getStage())return!1;if(null!==(t=this.attrs.perfectDrawEnabled)&&void 0!==t&&!t)return!1;const n=e||this.hasFill(),r=this.hasStroke(),a=1!==this.getAbsoluteOpacity();if(n&&r&&a)return!0;const o=this.hasShadow(),c=this.shadowForStrokeEnabled();return!!(n&&r&&o&&c)}setStrokeHitEnabled(e){rse.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const t=e.skipTransform,n=e.relativeTo,r=this.getSelfRect(),a=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=r.width+a,c=r.height+a,i=!e.skipShadow&&this.hasShadow(),l=i?this.shadowOffsetX():0,s=i?this.shadowOffsetY():0,h=o+Math.abs(l),d=c+Math.abs(s),u=i&&this.shadowBlur()||0,m={width:h+2*u,height:d+2*u,x:-(a/2+u)+Math.min(l,0)+r.x,y:-(a/2+u)+Math.min(s,0)+r.y};return t?m:this._transformedRect(m,n)}drawScene(e,t){var n,r,a=this.getLayer(),o=e||a.getCanvas(),c=o.getContext(),i=this._getCanvasCache(),l=this.getSceneFunc(),s=this.hasShadow(),h=o.isCache,d=t===this;if(!this.isVisible()&&!d)return this;if(i){c.save();var u=this.getAbsoluteTransform(t).getMatrix();return c.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(c),c.restore(),this}if(!l)return this;if(c.save(),this._useBufferCanvas()&&!h){(r=(n=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var m=this.getAbsoluteTransform(t).getMatrix();r.transform(m[0],m[1],m[2],m[3],m[4],m[5]),l.call(this,r,this),r.restore();var p=n.pixelRatio;s&&c._applyShadow(this),c._applyOpacity(this),c._applyGlobalCompositeOperation(this),c.drawImage(n._canvas,0,0,n.width/p,n.height/p)}else c._applyLineJoin(this),d||(m=this.getAbsoluteTransform(t).getMatrix(),c.transform(m[0],m[1],m[2],m[3],m[4],m[5]),c._applyOpacity(this),c._applyGlobalCompositeOperation(this)),s&&c._applyShadow(this),l.call(this,c,this);return c.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;var r=this.getLayer(),a=e||r.hitCanvas,o=a&&a.getContext(),c=this.hitFunc()||this.sceneFunc(),i=this._getCanvasCache(),l=i&&i.hit;if(this.colorKey||rse.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){o.save();var s=this.getAbsoluteTransform(t).getMatrix();return o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!c)return this;if(o.save(),o._applyLineJoin(this),this!==t){var h=this.getAbsoluteTransform(t).getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5])}return c.call(this,o,this),o.restore(),this}drawHitFromCache(e=0){var t,n,r,a,o,c=this._getCanvasCache(),i=this._getCachedSceneCanvas(),l=c.hit,s=l.getContext(),h=l.getWidth(),d=l.getHeight();s.clear(),s.drawImage(i._canvas,0,0,h,d);try{for(r=(n=(t=s.getImageData(0,0,h,d)).data).length,a=rse._hexToRgb(this.colorKey),o=0;o<r;o+=4)n[o+3]>e?(n[o]=a.r,n[o+1]=a.g,n[o+2]=a.b,n[o+3]=255):n[o+3]=0;s.putImageData(t,0,0)}catch(e){rse.error("Unable to draw hit graph from cached scene canvas. "+e.message)}return this}hasPointerCapture(e){return qse(e,this)}setPointerCapture(e){Gse(e,this)}releaseCapture(e){Yse(e)}}xhe.prototype._fillFunc=function(e){e.fill()},xhe.prototype._strokeFunc=function(e){e.stroke()},xhe.prototype._fillFuncHit=function(e){e.fill()},xhe.prototype._strokeFuncHit=function(e){e.stroke()},xhe.prototype._centroid=!1,xhe.prototype.nodeType="Shape",Yle(xhe),xhe.prototype.eventListeners={},xhe.prototype.on.call(xhe.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(bhe)})),xhe.prototype.on.call(xhe.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Hhe)})),xhe.prototype.on.call(xhe.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(Vhe)})),xhe.prototype.on.call(xhe.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(Che)})),xhe.prototype.on.call(xhe.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(Lhe)})),pse.addGetterSetter(xhe,"stroke",void 0,hse()),pse.addGetterSetter(xhe,"strokeWidth",2,cse()),pse.addGetterSetter(xhe,"fillAfterStrokeEnabled",!1),pse.addGetterSetter(xhe,"hitStrokeWidth","auto",lse()),pse.addGetterSetter(xhe,"strokeHitEnabled",!0,dse()),pse.addGetterSetter(xhe,"perfectDrawEnabled",!0,dse()),pse.addGetterSetter(xhe,"shadowForStrokeEnabled",!0,dse()),pse.addGetterSetter(xhe,"lineJoin"),pse.addGetterSetter(xhe,"lineCap"),pse.addGetterSetter(xhe,"sceneFunc"),pse.addGetterSetter(xhe,"hitFunc"),pse.addGetterSetter(xhe,"dash"),pse.addGetterSetter(xhe,"dashOffset",0,cse()),pse.addGetterSetter(xhe,"shadowColor",void 0,sse()),pse.addGetterSetter(xhe,"shadowBlur",0,cse()),pse.addGetterSetter(xhe,"shadowOpacity",1,cse()),pse.addComponentsGetterSetter(xhe,"shadowOffset",["x","y"]),pse.addGetterSetter(xhe,"shadowOffsetX",0,cse()),pse.addGetterSetter(xhe,"shadowOffsetY",0,cse()),pse.addGetterSetter(xhe,"fillPatternImage"),pse.addGetterSetter(xhe,"fill",void 0,hse()),pse.addGetterSetter(xhe,"fillPatternX",0,cse()),pse.addGetterSetter(xhe,"fillPatternY",0,cse()),pse.addGetterSetter(xhe,"fillLinearGradientColorStops"),pse.addGetterSetter(xhe,"strokeLinearGradientColorStops"),pse.addGetterSetter(xhe,"fillRadialGradientStartRadius",0),pse.addGetterSetter(xhe,"fillRadialGradientEndRadius",0),pse.addGetterSetter(xhe,"fillRadialGradientColorStops"),pse.addGetterSetter(xhe,"fillPatternRepeat","repeat"),pse.addGetterSetter(xhe,"fillEnabled",!0),pse.addGetterSetter(xhe,"strokeEnabled",!0),pse.addGetterSetter(xhe,"shadowEnabled",!0),pse.addGetterSetter(xhe,"dashEnabled",!0),pse.addGetterSetter(xhe,"strokeScaleEnabled",!0),pse.addGetterSetter(xhe,"fillPriority","color"),pse.addComponentsGetterSetter(xhe,"fillPatternOffset",["x","y"]),pse.addGetterSetter(xhe,"fillPatternOffsetX",0,cse()),pse.addGetterSetter(xhe,"fillPatternOffsetY",0,cse()),pse.addComponentsGetterSetter(xhe,"fillPatternScale",["x","y"]),pse.addGetterSetter(xhe,"fillPatternScaleX",1,cse()),pse.addGetterSetter(xhe,"fillPatternScaleY",1,cse()),pse.addComponentsGetterSetter(xhe,"fillLinearGradientStartPoint",["x","y"]),pse.addComponentsGetterSetter(xhe,"strokeLinearGradientStartPoint",["x","y"]),pse.addGetterSetter(xhe,"fillLinearGradientStartPointX",0),pse.addGetterSetter(xhe,"strokeLinearGradientStartPointX",0),pse.addGetterSetter(xhe,"fillLinearGradientStartPointY",0),pse.addGetterSetter(xhe,"strokeLinearGradientStartPointY",0),pse.addComponentsGetterSetter(xhe,"fillLinearGradientEndPoint",["x","y"]),pse.addComponentsGetterSetter(xhe,"strokeLinearGradientEndPoint",["x","y"]),pse.addGetterSetter(xhe,"fillLinearGradientEndPointX",0),pse.addGetterSetter(xhe,"strokeLinearGradientEndPointX",0),pse.addGetterSetter(xhe,"fillLinearGradientEndPointY",0),pse.addGetterSetter(xhe,"strokeLinearGradientEndPointY",0),pse.addComponentsGetterSetter(xhe,"fillRadialGradientStartPoint",["x","y"]),pse.addGetterSetter(xhe,"fillRadialGradientStartPointX",0),pse.addGetterSetter(xhe,"fillRadialGradientStartPointY",0),pse.addComponentsGetterSetter(xhe,"fillRadialGradientEndPoint",["x","y"]),pse.addGetterSetter(xhe,"fillRadialGradientEndPointX",0),pse.addGetterSetter(xhe,"fillRadialGradientEndPointY",0),pse.addGetterSetter(xhe,"fillPatternRotation",0),pse.backCompat(xhe,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var The=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Ohe=The.length;class Ahe extends Bse{constructor(e){super(e),this.canvas=new Ese,this.hitCanvas=new bse({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Fse.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!Fse.prototype.moveUp.call(this))return!1;var e=this.getStage();return!(!e||!e.content||(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),0))}moveDown(){if(Fse.prototype.moveDown.call(this)){var e=this.getStage();if(e){var t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Fse.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return Fse.prototype.remove.call(this),e&&e.parentNode&&rse._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&rse.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return(e=e||{}).width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=void 0!==e.x?e.x:this.x(),e.y=void 0!==e.y?e.y:this.y(),Fse.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){const e=this.visible();this.canvas._canvas.style.display=e?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){rse.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){rse.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,rse.requestAnimFrame((()=>{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var t=1,n=!1;;){for(let r=0;r<Ohe;r++){const a=The[r],o=this._getIntersection({x:e.x+a.x*t,y:e.y+a.y*t}),c=o.shape;if(c)return c;if(n=!!o.antialiased,!o.antialiased)break}if(!n)return null;t+=1}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(255===r){const e=rse._rgbToHex(n[0],n[1],n[2]),t=She["#"+e];return t?{shape:t}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Bse.prototype.drawScene.call(this,r,t),this._fire("draw",{node:this}),this}drawHit(e,t){var n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Bse.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){rse.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return rse.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return rse.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Ahe.prototype.nodeType="Layer",Yle(Ahe),pse.addGetterSetter(Ahe,"imageSmoothingEnabled",!0),pse.addGetterSetter(Ahe,"clearBeforeDraw",!0),pse.addGetterSetter(Ahe,"hitGraphEnabled",!0,dse());class Rhe extends Ahe{constructor(e){super(e),this.listening(!1),rse.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Rhe.prototype.nodeType="FastLayer",Yle(Rhe);class Nhe extends Bse{_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&rse.throw("You may only add groups and shapes to groups.")}}Nhe.prototype.nodeType="Group",Yle(Nhe);var _he=qle.performance&&qle.performance.now?function(){return qle.performance.now()}:function(){return(new Date).getTime()};class Dhe{constructor(e,t){this.id=Dhe.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:_he(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){var t;return t=e?e.length>0?e:[e]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(e){var t,n=this.layers,r=n.length;for(t=0;t<r;t++)if(n[t]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){var e,t=Dhe.animations,n=t.length;for(e=0;e<n;e++)if(t[e].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=_he(),Dhe._addAnimation(this),this}stop(){return Dhe._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){var t,n=e.id,r=this.animations,a=r.length;for(t=0;t<a;t++)if(r[t].id===n){this.animations.splice(t,1);break}}static _runFrames(){var e,t,n,r,a,o,c,i,l={},s=this.animations;for(r=0;r<s.length;r++)if(t=(e=s[r]).layers,n=e.func,e._updateFrameObject(_he()),o=t.length,!n||!1!==n.call(e,e.frame))for(a=0;a<o;a++)void 0!==(c=t[a])._id&&(l[c._id]=c);for(i in l)l.hasOwnProperty(i)&&l[i].batchDraw()}static _animationLoop(){var e=Dhe;e.animations.length?(e._runFrames(),rse.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,rse.requestAnimFrame(this._animationLoop))}}Dhe.animations=[],Dhe.animIdCounter=0,Dhe.animRunning=!1;var Phe={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Fhe=0,Ihe=["fill","stroke","shadowColor"];class Bhe{constructor(e,t,n,r,a,o,c){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=o,this._change=0,this.prevPos=0,this.yoyo=c,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=a-this.begin,this.pause()}fire(e){var t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class jhe{constructor(e){var t,n,r=this,a=e.node,o=a._id,c=e.easing||Uhe.Linear,i=!!e.yoyo;t=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=a,this._id=Fhe++;var l=a.getLayer()||(a instanceof Gle.Stage?a.getLayers():null);for(n in l||rse.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Dhe((function(){r.tween.onEnterFrame()}),l),this.tween=new Bhe(n,(function(e){r._tweenFunc(e)}),c,0,1,1e3*t,i),this._addListeners(),jhe.attrs[o]||(jhe.attrs[o]={}),jhe.attrs[o][this._id]||(jhe.attrs[o][this._id]={}),jhe.tweens[o]||(jhe.tweens[o]={}),e)void 0===Phe[n]&&this._addAttr(n,e[n]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){var n,r,a,o,c,i,l,s,h=this.node,d=h._id;if((a=jhe.tweens[d][e])&&delete jhe.attrs[d][a][e],n=h.getAttr(e),rse._isArray(t))if(r=[],c=Math.max(t.length,n.length),"points"===e&&t.length!==n.length&&(t.length>n.length?(l=n,n=rse._prepareArrayForTween(n,t,h.closed())):(i=t,t=rse._prepareArrayForTween(t,n,h.closed()))),0===e.indexOf("fill"))for(o=0;o<c;o++)if(o%2==0)r.push(t[o]-n[o]);else{var u=rse.colorToRGBA(n[o]);s=rse.colorToRGBA(t[o]),n[o]=u,r.push({r:s.r-u.r,g:s.g-u.g,b:s.b-u.b,a:s.a-u.a})}else for(o=0;o<c;o++)r.push(t[o]-n[o]);else-1!==Ihe.indexOf(e)?(n=rse.colorToRGBA(n),r={r:(s=rse.colorToRGBA(t)).r-n.r,g:s.g-n.g,b:s.b-n.b,a:s.a-n.a}):r=t-n;jhe.attrs[d][this._id][e]={start:n,diff:r,end:t,trueEnd:i,trueStart:l},jhe.tweens[d][e]=this._id}_tweenFunc(e){var t,n,r,a,o,c,i,l,s=this.node,h=jhe.attrs[s._id][this._id];for(t in h){if(r=(n=h[t]).start,a=n.diff,l=n.end,rse._isArray(r))if(o=[],i=Math.max(r.length,l.length),0===t.indexOf("fill"))for(c=0;c<i;c++)c%2==0?o.push((r[c]||0)+a[c]*e):o.push("rgba("+Math.round(r[c].r+a[c].r*e)+","+Math.round(r[c].g+a[c].g*e)+","+Math.round(r[c].b+a[c].b*e)+","+(r[c].a+a[c].a*e)+")");else for(c=0;c<i;c++)o.push((r[c]||0)+a[c]*e);else o=-1!==Ihe.indexOf(t)?"rgba("+Math.round(r.r+a.r*e)+","+Math.round(r.g+a.g*e)+","+Math.round(r.b+a.b*e)+","+(r.a+a.a*e)+")":r+a*e;s.setAttr(t,o)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,t=jhe.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,t=jhe.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e,t=this.node._id,n=this._id,r=jhe.tweens[t];for(e in this.pause(),r)delete jhe.tweens[t][e];delete jhe.attrs[t][n]}}jhe.attrs={},jhe.tweens={},Fse.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new jhe(e).play()};const Uhe={BackEaseIn(e,t,n,r){var a=1.70158;return n*(e/=r)*e*((a+1)*e-a)+t},BackEaseOut(e,t,n,r){var a=1.70158;return n*((e=e/r-1)*e*((a+1)*e+a)+1)+t},BackEaseInOut(e,t,n,r){var a=1.70158;return(e/=r/2)<1?n/2*(e*e*((1+(a*=1.525))*e-a))+t:n/2*((e-=2)*e*((1+(a*=1.525))*e+a)+2)+t},ElasticEaseIn(e,t,n,r,a,o){var c=0;return 0===e?t:1==(e/=r)?t+n:(o||(o=.3*r),!a||a<Math.abs(n)?(a=n,c=o/4):c=o/(2*Math.PI)*Math.asin(n/a),-a*Math.pow(2,10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/o)+t)},ElasticEaseOut(e,t,n,r,a,o){var c=0;return 0===e?t:1==(e/=r)?t+n:(o||(o=.3*r),!a||a<Math.abs(n)?(a=n,c=o/4):c=o/(2*Math.PI)*Math.asin(n/a),a*Math.pow(2,-10*e)*Math.sin((e*r-c)*(2*Math.PI)/o)+n+t)},ElasticEaseInOut(e,t,n,r,a,o){var c=0;return 0===e?t:2==(e/=r/2)?t+n:(o||(o=r*(.3*1.5)),!a||a<Math.abs(n)?(a=n,c=o/4):c=o/(2*Math.PI)*Math.asin(n/a),e<1?a*Math.pow(2,10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/o)*-.5+t:a*Math.pow(2,-10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/o)*.5+n+t)},BounceEaseOut:(e,t,n,r)=>(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,t,n,r)=>n-Uhe.BounceEaseOut(r-e,0,n,r)+t,BounceEaseInOut:(e,t,n,r)=>e<r/2?.5*Uhe.BounceEaseIn(2*e,0,n,r)+t:.5*Uhe.BounceEaseOut(2*e-r,0,n,r)+.5*n+t,EaseIn:(e,t,n,r)=>n*(e/=r)*e+t,EaseOut:(e,t,n,r)=>-n*(e/=r)*(e-2)+t,EaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,r)=>n*(e/=r)*e*e*e*e+t,StrongEaseOut:(e,t,n,r)=>n*((e=e/r-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,r)=>n*e/r+t},Whe=rse._assign(Gle,{Util:rse,Transform:Kle,Node:Fse,Container:Bse,Stage:Ehe,stages:Mhe,Layer:Ahe,FastLayer:Rhe,Group:Nhe,DD:Hse,Shape:xhe,shapes:She,Animation:Dhe,Tween:jhe,Easings:Uhe,Context:zse,Canvas:Mse});class $he extends xhe{_sceneFunc(e){var t=Gle.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=Gle.getAngle(n?360-this.angle():this.angle()),a=Math.cos(Math.min(r,Math.PI)),o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),c=Math.sin(Math.min(r,Math.PI/2)),i=a*(a>0?e:t),l=o*(o>0?e:t),s=c*(c>0?t:e);return{x:i,y:n?-1*s:l,width:1*t-i,height:s-l}}}function qhe(e,t,n,r,a,o,c){var i=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(a-n,2)+Math.pow(o-r,2)),s=c*i/(i+l),h=c*l/(i+l);return[n-s*(a-e),r-s*(o-t),n+h*(a-e),r+h*(o-t)]}function Ghe(e,t){var n,r,a=e.length,o=[];for(n=2;n<a-2;n+=2)r=qhe(e[n-2],e[n-1],e[n],e[n+1],e[n+2],e[n+3],t),isNaN(r[0])||(o.push(r[0]),o.push(r[1]),o.push(e[n]),o.push(e[n+1]),o.push(r[2]),o.push(r[3]));return o}$he.prototype._centroid=!0,$he.prototype.className="Arc",$he.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Yle($he),pse.addGetterSetter($he,"innerRadius",0,cse()),pse.addGetterSetter($he,"outerRadius",0,cse()),pse.addGetterSetter($he,"angle",0,cse()),pse.addGetterSetter($he,"clockwise",!1,dse());class Yhe extends xhe{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")}))}_sceneFunc(e){var t,n,r,a=this.points(),o=a.length,c=this.tension(),i=this.closed(),l=this.bezier();if(o){if(e.beginPath(),e.moveTo(a[0],a[1]),0!==c&&o>4){for(n=(t=this.getTensionPoints()).length,r=i?0:4,i||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);r<n-2;)e.bezierCurveTo(t[r++],t[r++],t[r++],t[r++],t[r++],t[r++]);i||e.quadraticCurveTo(t[n-2],t[n-1],a[o-2],a[o-1])}else if(l)for(r=2;r<o;)e.bezierCurveTo(a[r++],a[r++],a[r++],a[r++],a[r++],a[r++]);else for(r=2;r<o;r+=2)e.lineTo(a[r],a[r+1]);i?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Ghe(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),t=e.length,n=this.tension(),r=qhe(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),a=qhe(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),o=Ghe(e,n);return[r[2],r[3]].concat(o).concat([a[0],a[1],e[t-2],e[t-1],a[2],a[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};for(var t,n,r=(e=0!==this.tension()?[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.points())[0],a=e[0],o=e[1],c=e[1],i=0;i<e.length/2;i++)t=e[2*i],n=e[2*i+1],r=Math.min(r,t),a=Math.max(a,t),o=Math.min(o,n),c=Math.max(c,n);return{x:r,y:o,width:a-r,height:c-o}}}Yhe.prototype.className="Line",Yhe.prototype._attrsAffectingSize=["points","bezier","tension"],Yle(Yhe),pse.addGetterSetter(Yhe,"closed",!1),pse.addGetterSetter(Yhe,"bezier",!1),pse.addGetterSetter(Yhe,"tension",0,cse()),pse.addGetterSetter(Yhe,"points",[],function(){if(Gle.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(rse._isArray(e)?e.forEach((function(e){rse._isNumber(e)||rse.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")})):rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}());class Khe extends xhe{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this.dataArray=Khe.parsePathData(this.data()),this.pathLength=0;for(var t=0;t<this.dataArray.length;++t)this.pathLength+=this.dataArray[t].pathLength;this.on("dataChange.konva",(function(){this.dataArray=Khe.parsePathData(this.data()),this.pathLength=0;for(var e=0;e<this.dataArray.length;++e)this.pathLength+=this.dataArray[e].pathLength}))}_sceneFunc(e){var t=this.dataArray;e.beginPath();for(var n=!1,r=0;r<t.length;r++){var a=t[r].command,o=t[r].points;switch(a){case"L":e.lineTo(o[0],o[1]);break;case"M":e.moveTo(o[0],o[1]);break;case"C":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"Q":e.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case"A":var c=o[0],i=o[1],l=o[2],s=o[3],h=o[4],d=o[5],u=o[6],m=o[7],p=l>s?l:s,v=l>s?1:l/s,f=l>s?s/l:1;e.translate(c,i),e.rotate(u),e.scale(v,f),e.arc(0,0,p,h,h+d,1-m),e.scale(1/v,1/f),e.rotate(-u),e.translate(-c,-i);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach((function(t){if("A"===t.command){var n=t.points[4],r=t.points[5],a=t.points[4]+r,o=Math.PI/180;if(Math.abs(n-a)<o&&(o=Math.abs(n-a)),r<0)for(let r=n-o;r>a;r-=o){const n=Khe.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}else for(let r=n+o;r<a;r+=o){const n=Khe.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}}else if("C"===t.command)for(let n=0;n<=1;n+=.01){const r=Khe.getPointOnCubicBezier(n,t.start.x,t.start.y,t.points[0],t.points[1],t.points[2],t.points[3],t.points[4],t.points[5]);e.push(r.x,r.y)}else e=e.concat(t.points)}));for(var t,n,r=e[0],a=e[0],o=e[1],c=e[1],i=0;i<e.length/2;i++)t=e[2*i],n=e[2*i+1],isNaN(t)||(r=Math.min(r,t),a=Math.max(a,t)),isNaN(n)||(o=Math.min(o,n),c=Math.max(c,n));return{x:r,y:o,width:a-r,height:c-o}}getLength(){return this.pathLength}getPointAtLength(e){var t,n=0,r=this.dataArray.length;if(!r)return null;for(;n<r&&e>this.dataArray[n].pathLength;)e-=this.dataArray[n].pathLength,++n;if(n===r)return{x:(t=this.dataArray[n-1].points.slice(-2))[0],y:t[1]};if(e<.01)return{x:(t=this.dataArray[n].points.slice(0,2))[0],y:t[1]};var a=this.dataArray[n],o=a.points;switch(a.command){case"L":return Khe.getPointOnLine(e,a.start.x,a.start.y,o[0],o[1]);case"C":return Khe.getPointOnCubicBezier(e/a.pathLength,a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return Khe.getPointOnQuadraticBezier(e/a.pathLength,a.start.x,a.start.y,o[0],o[1],o[2],o[3]);case"A":var c=o[0],i=o[1],l=o[2],s=o[3],h=o[4],d=o[5],u=o[6];return h+=d*e/a.pathLength,Khe.getPointOnEllipticalArc(c,i,l,s,h,u)}return null}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPointOnLine(e,t,n,r,a,o,c){void 0===o&&(o=t),void 0===c&&(c=n);var i=(a-n)/(r-t+1e-8),l=Math.sqrt(e*e/(1+i*i));r<t&&(l*=-1);var s,h=i*l;if(r===t)s={x:o,y:c+h};else if((c-n)/(o-t+1e-8)===i)s={x:o+l,y:c+h};else{var d,u,m=this.getLineLength(t,n,r,a),p=(o-t)*(r-t)+(c-n)*(a-n);d=t+(p/=m*m)*(r-t),u=n+p*(a-n);var v=this.getLineLength(o,c,d,u),f=Math.sqrt(e*e-v*v);l=Math.sqrt(f*f/(1+i*i)),r<t&&(l*=-1),s={x:d+l,y:u+(h=i*l)}}return s}static getPointOnCubicBezier(e,t,n,r,a,o,c,i,l){function s(e){return e*e*e}function h(e){return 3*e*e*(1-e)}function d(e){return 3*e*(1-e)*(1-e)}function u(e){return(1-e)*(1-e)*(1-e)}return{x:i*s(e)+o*h(e)+r*d(e)+t*u(e),y:l*s(e)+c*h(e)+a*d(e)+n*u(e)}}static getPointOnQuadraticBezier(e,t,n,r,a,o,c){function i(e){return e*e}function l(e){return 2*e*(1-e)}function s(e){return(1-e)*(1-e)}return{x:o*i(e)+r*l(e)+t*s(e),y:c*i(e)+a*l(e)+n*s(e)}}static getPointOnEllipticalArc(e,t,n,r,a,o){var c=Math.cos(o),i=Math.sin(o),l=n*Math.cos(a),s=r*Math.sin(a);return{x:e+(l*c-s*i),y:t+(l*i+s*c)}}static parsePathData(e){if(!e)return[];var t=e,n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];t=t.replace(new RegExp(" ","g"),",");for(var r=0;r<n.length;r++)t=t.replace(new RegExp(n[r],"g"),"|"+n[r]);var a,o=t.split("|"),c=[],i=[],l=0,s=0,h=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;for(r=1;r<o.length;r++){var d=o[r],u=d.charAt(0);for(d=d.slice(1),i.length=0;a=h.exec(d);)i.push(a[0]);for(var m=[],p=0,v=i.length;p<v;p++)if("00"!==i[p]){var f=parseFloat(i[p]);isNaN(f)?m.push(0):m.push(f)}else m.push(0,0);for(;m.length>0&&!isNaN(m[0]);){var z,g,y,M,E,b,H,V,C,L,k=null,w=[],S=l,x=s;switch(u){case"l":l+=m.shift(),s+=m.shift(),k="L",w.push(l,s);break;case"L":l=m.shift(),s=m.shift(),w.push(l,s);break;case"m":var T=m.shift(),O=m.shift();if(l+=T,s+=O,k="M",c.length>2&&"z"===c[c.length-1].command)for(var A=c.length-2;A>=0;A--)if("M"===c[A].command){l=c[A].points[0]+T,s=c[A].points[1]+O;break}w.push(l,s),u="l";break;case"M":l=m.shift(),s=m.shift(),k="M",w.push(l,s),u="L";break;case"h":l+=m.shift(),k="L",w.push(l,s);break;case"H":l=m.shift(),k="L",w.push(l,s);break;case"v":s+=m.shift(),k="L",w.push(l,s);break;case"V":s=m.shift(),k="L",w.push(l,s);break;case"C":w.push(m.shift(),m.shift(),m.shift(),m.shift()),l=m.shift(),s=m.shift(),w.push(l,s);break;case"c":w.push(l+m.shift(),s+m.shift(),l+m.shift(),s+m.shift()),l+=m.shift(),s+=m.shift(),k="C",w.push(l,s);break;case"S":g=l,y=s,"C"===(z=c[c.length-1]).command&&(g=l+(l-z.points[2]),y=s+(s-z.points[3])),w.push(g,y,m.shift(),m.shift()),l=m.shift(),s=m.shift(),k="C",w.push(l,s);break;case"s":g=l,y=s,"C"===(z=c[c.length-1]).command&&(g=l+(l-z.points[2]),y=s+(s-z.points[3])),w.push(g,y,l+m.shift(),s+m.shift()),l+=m.shift(),s+=m.shift(),k="C",w.push(l,s);break;case"Q":w.push(m.shift(),m.shift()),l=m.shift(),s=m.shift(),w.push(l,s);break;case"q":w.push(l+m.shift(),s+m.shift()),l+=m.shift(),s+=m.shift(),k="Q",w.push(l,s);break;case"T":g=l,y=s,"Q"===(z=c[c.length-1]).command&&(g=l+(l-z.points[0]),y=s+(s-z.points[1])),l=m.shift(),s=m.shift(),k="Q",w.push(g,y,l,s);break;case"t":g=l,y=s,"Q"===(z=c[c.length-1]).command&&(g=l+(l-z.points[0]),y=s+(s-z.points[1])),l+=m.shift(),s+=m.shift(),k="Q",w.push(g,y,l,s);break;case"A":M=m.shift(),E=m.shift(),b=m.shift(),H=m.shift(),V=m.shift(),C=l,L=s,l=m.shift(),s=m.shift(),k="A",w=this.convertEndpointToCenterParameterization(C,L,l,s,H,V,M,E,b);break;case"a":M=m.shift(),E=m.shift(),b=m.shift(),H=m.shift(),V=m.shift(),C=l,L=s,l+=m.shift(),s+=m.shift(),k="A",w=this.convertEndpointToCenterParameterization(C,L,l,s,H,V,M,E,b)}c.push({command:k||u,points:w,start:{x:S,y:x},pathLength:this.calcLength(S,x,k||u,w)})}"z"!==u&&"Z"!==u||c.push({command:"z",points:[],start:void 0,pathLength:0})}return c}static calcLength(e,t,n,r){var a,o,c,i,l=Khe;switch(n){case"L":return l.getLineLength(e,t,r[0],r[1]);case"C":for(a=0,o=l.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),i=.01;i<=1;i+=.01)c=l.getPointOnCubicBezier(i,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),a+=l.getLineLength(o.x,o.y,c.x,c.y),o=c;return a;case"Q":for(a=0,o=l.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),i=.01;i<=1;i+=.01)c=l.getPointOnQuadraticBezier(i,e,t,r[0],r[1],r[2],r[3]),a+=l.getLineLength(o.x,o.y,c.x,c.y),o=c;return a;case"A":a=0;var s=r[4],h=r[5],d=r[4]+h,u=Math.PI/180;if(Math.abs(s-d)<u&&(u=Math.abs(s-d)),o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],s,0),h<0)for(i=s-u;i>d;i-=u)c=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],i,0),a+=l.getLineLength(o.x,o.y,c.x,c.y),o=c;else for(i=s+u;i<d;i+=u)c=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],i,0),a+=l.getLineLength(o.x,o.y,c.x,c.y),o=c;return c=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],d,0),a+l.getLineLength(o.x,o.y,c.x,c.y)}return 0}static convertEndpointToCenterParameterization(e,t,n,r,a,o,c,i,l){var s=l*(Math.PI/180),h=Math.cos(s)*(e-n)/2+Math.sin(s)*(t-r)/2,d=-1*Math.sin(s)*(e-n)/2+Math.cos(s)*(t-r)/2,u=h*h/(c*c)+d*d/(i*i);u>1&&(c*=Math.sqrt(u),i*=Math.sqrt(u));var m=Math.sqrt((c*c*(i*i)-c*c*(d*d)-i*i*(h*h))/(c*c*(d*d)+i*i*(h*h)));a===o&&(m*=-1),isNaN(m)&&(m=0);var p=m*c*d/i,v=m*-i*h/c,f=(e+n)/2+Math.cos(s)*p-Math.sin(s)*v,z=(t+r)/2+Math.sin(s)*p+Math.cos(s)*v,g=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},y=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(g(e)*g(t))},M=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(y(e,t))},E=M([1,0],[(h-p)/c,(d-v)/i]),b=[(h-p)/c,(d-v)/i],H=[(-1*h-p)/c,(-1*d-v)/i],V=M(b,H);return y(b,H)<=-1&&(V=Math.PI),y(b,H)>=1&&(V=0),0===o&&V>0&&(V-=2*Math.PI),1===o&&V<0&&(V+=2*Math.PI),[f,z,c,i,E,V,s,o]}}Khe.prototype.className="Path",Khe.prototype._attrsAffectingSize=["data"],Yle(Khe),pse.addGetterSetter(Khe,"data");class Xhe extends Yhe{_sceneFunc(e){super._sceneFunc(e);var t=2*Math.PI,n=this.points(),r=n,a=0!==this.tension()&&n.length>4;a&&(r=this.getTensionPoints());var o,c,i=this.pointerLength(),l=n.length;if(a){const e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[l-2],n[l-1]],t=Khe.calcLength(r[r.length-4],r[r.length-3],"C",e),a=Khe.getPointOnQuadraticBezier(Math.min(1,1-i/t),e[0],e[1],e[2],e[3],e[4],e[5]);o=n[l-2]-a.x,c=n[l-1]-a.y}else o=n[l-2]-n[l-4],c=n[l-1]-n[l-3];var s=(Math.atan2(c,o)+t)%t,h=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[l-2],n[l-1]),e.rotate(s),e.moveTo(0,0),e.lineTo(-i,h/2),e.lineTo(-i,-h/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),a?(o=(r[0]+r[2])/2-n[0],c=(r[1]+r[3])/2-n[1]):(o=n[2]-n[0],c=n[3]-n[1]),e.rotate((Math.atan2(-c,-o)+t)%t),e.moveTo(0,0),e.lineTo(-i,h/2),e.lineTo(-i,-h/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}Xhe.prototype.className="Arrow",Yle(Xhe),pse.addGetterSetter(Xhe,"pointerLength",10,cse()),pse.addGetterSetter(Xhe,"pointerWidth",10,cse()),pse.addGetterSetter(Xhe,"pointerAtBeginning",!1),pse.addGetterSetter(Xhe,"pointerAtEnding",!0);class Qhe extends xhe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Qhe.prototype._centroid=!0,Qhe.prototype.className="Circle",Qhe.prototype._attrsAffectingSize=["radius"],Yle(Qhe),pse.addGetterSetter(Qhe,"radius",0,cse());class Jhe extends xhe{_sceneFunc(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Jhe.prototype.className="Ellipse",Jhe.prototype._centroid=!0,Jhe.prototype._attrsAffectingSize=["radiusX","radiusY"],Yle(Jhe),pse.addComponentsGetterSetter(Jhe,"radius",["x","y"]),pse.addGetterSetter(Jhe,"radiusX",0,cse()),pse.addGetterSetter(Jhe,"radiusY",0,cse());class Zhe extends xhe{constructor(e){super(e),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&4===e.readyState||e&&e.addEventListener&&e.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const t=this.getWidth(),n=this.getHeight(),r=this.cornerRadius(),a=this.attrs.image;let o;if(a){const e=this.attrs.cropWidth,r=this.attrs.cropHeight;o=e&&r?[a,this.cropX(),this.cropY(),e,r,0,0,t,n]:[a,0,0,t,n]}(this.hasFill()||this.hasStroke()||r)&&(e.beginPath(),r?rse.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),a&&(r&&e.clip(),e.drawImage.apply(e,o))}_hitFunc(e){var t=this.width(),n=this.height(),r=this.cornerRadius();e.beginPath(),r?rse.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}getHeight(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}static fromURL(e,t,n=null){var r=rse.createImageElement();r.onload=function(){var e=new Zhe({image:r});t(e)},r.onerror=n,r.crossOrigin="Anonymous",r.src=e}}Zhe.prototype.className="Image",Yle(Zhe),pse.addGetterSetter(Zhe,"cornerRadius",0,ise(4)),pse.addGetterSetter(Zhe,"image"),pse.addComponentsGetterSetter(Zhe,"crop",["x","y","width","height"]),pse.addGetterSetter(Zhe,"cropX",0,cse()),pse.addGetterSetter(Zhe,"cropY",0,cse()),pse.addGetterSetter(Zhe,"cropWidth",0,cse()),pse.addGetterSetter(Zhe,"cropHeight",0,cse());var ede=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],tde="up",nde="right",rde="down",ade="left",ode=ede.length;class cde extends Nhe{constructor(e){super(e),this.on("add.konva",(function(e){this._addListeners(e.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var t,n=this,r=function(){n._sync()};for(t=0;t<ode;t++)e.on(ede[t]+"Change.konva",r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e,t,n,r,a,o,c,i=this.getText(),l=this.getTag();if(i&&l){switch(e=i.width(),t=i.height(),n=l.pointerDirection(),r=l.pointerWidth(),c=l.pointerHeight(),a=0,o=0,n){case tde:a=e/2,o=-1*c;break;case nde:a=e+r,o=t/2;break;case rde:a=e/2,o=t+c;break;case ade:a=-1*r,o=t/2}l.setAttrs({x:-1*a,y:-1*o,width:e,height:t}),i.setAttrs({x:-1*a,y:-1*o})}}}cde.prototype.className="Label",Yle(cde);class ide extends xhe{_sceneFunc(e){var t=this.width(),n=this.height(),r=this.pointerDirection(),a=this.pointerWidth(),o=this.pointerHeight(),c=this.cornerRadius();let i=0,l=0,s=0,h=0;"number"==typeof c?i=l=s=h=Math.min(c,t/2,n/2):(i=Math.min(c[0]||0,t/2,n/2),l=Math.min(c[1]||0,t/2,n/2),h=Math.min(c[2]||0,t/2,n/2),s=Math.min(c[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(i,0),r===tde&&(e.lineTo((t-a)/2,0),e.lineTo(t/2,-1*o),e.lineTo((t+a)/2,0)),e.lineTo(t-l,0),e.arc(t-l,l,l,3*Math.PI/2,0,!1),r===nde&&(e.lineTo(t,(n-o)/2),e.lineTo(t+a,n/2),e.lineTo(t,(n+o)/2)),e.lineTo(t,n-h),e.arc(t-h,n-h,h,0,Math.PI/2,!1),r===rde&&(e.lineTo((t+a)/2,n),e.lineTo(t/2,n+o),e.lineTo((t-a)/2,n)),e.lineTo(s,n),e.arc(s,n-s,s,Math.PI/2,Math.PI,!1),r===ade&&(e.lineTo(0,(n+o)/2),e.lineTo(-1*a,n/2),e.lineTo(0,(n-o)/2)),e.lineTo(0,i),e.arc(i,i,i,Math.PI,3*Math.PI/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),a=this.pointerDirection(),o=this.width(),c=this.height();return a===tde?(t-=r,c+=r):a===rde?c+=r:a===ade?(e-=1.5*n,o+=n):a===nde&&(o+=1.5*n),{x:e,y:t,width:o,height:c}}}ide.prototype.className="Tag",Yle(ide),pse.addGetterSetter(ide,"pointerDirection","none"),pse.addGetterSetter(ide,"pointerWidth",0,cse()),pse.addGetterSetter(ide,"pointerHeight",0,cse()),pse.addGetterSetter(ide,"cornerRadius",0,ise(4));class lde extends xhe{_sceneFunc(e){var t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?rse.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}}lde.prototype.className="Rect",Yle(lde),pse.addGetterSetter(lde,"cornerRadius",0,ise(4));class sde extends xhe{_sceneFunc(e){const t=this._getPoints();e.beginPath(),e.moveTo(t[0].x,t[0].y);for(var n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(var r=0;r<e;r++)n.push({x:t*Math.sin(2*r*Math.PI/e),y:-1*t*Math.cos(2*r*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();var t=e[0].x,n=e[0].y,r=e[0].x,a=e[0].y;return e.forEach((e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),a=Math.max(a,e.y)})),{x:t,y:r,width:n-t,height:a-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}sde.prototype.className="RegularPolygon",sde.prototype._centroid=!0,sde.prototype._attrsAffectingSize=["radius"],Yle(sde),pse.addGetterSetter(sde,"radius",0,cse()),pse.addGetterSetter(sde,"sides",0,cse());var hde=2*Math.PI;class dde extends xhe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,hde,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),hde,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}dde.prototype.className="Ring",dde.prototype._centroid=!0,dde.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Yle(dde),pse.addGetterSetter(dde,"innerRadius",0,cse()),pse.addGetterSetter(dde,"outerRadius",0,cse());class ude extends xhe{constructor(e){super(e),this._updated=!0,this.anim=new Dhe((()=>{var e=this._updated;return this._updated=!1,e})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,a=this.animations()[t],o=this.frameOffsets(),c=a[r+0],i=a[r+1],l=a[r+2],s=a[r+3],h=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,s),e.closePath(),e.fillStrokeShape(this)),h)if(o){var d=o[t],u=2*n;e.drawImage(h,c,i,l,s,d[u+0],d[u+1],l,s)}else e.drawImage(h,c,i,l,s,0,0,l,s)}_hitFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,a=this.animations()[t],o=this.frameOffsets(),c=a[r+2],i=a[r+3];if(e.beginPath(),o){var l=o[t],s=2*n;e.rect(l[s+0],l[s+1],c,i)}else e.rect(0,0,c,i);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval((function(){e._updateIndex()}),1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}}ude.prototype.className="Sprite",Yle(ude),pse.addGetterSetter(ude,"animation"),pse.addGetterSetter(ude,"animations"),pse.addGetterSetter(ude,"frameOffsets"),pse.addGetterSetter(ude,"image"),pse.addGetterSetter(ude,"frameIndex",0,cse()),pse.addGetterSetter(ude,"frameRate",17,cse()),pse.backCompat(ude,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class mde extends xhe{_sceneFunc(e){var t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(var a=1;a<2*r;a++){var o=a%2==0?n:t,c=o*Math.sin(a*Math.PI/r),i=-1*o*Math.cos(a*Math.PI/r);e.lineTo(c,i)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}function pde(e){return Array.from(e)}mde.prototype.className="Star",mde.prototype._centroid=!0,mde.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Yle(mde),pse.addGetterSetter(mde,"numPoints",5,cse()),pse.addGetterSetter(mde,"innerRadius",0,cse()),pse.addGetterSetter(mde,"outerRadius",0,cse());var vde,fde="auto",zde="justify",gde="left",yde="middle",Mde="normal",Ede=" ",bde="none",Hde=["fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Vde=Hde.length;function Cde(){return vde||(vde=rse.createCanvasElement().getContext("2d"))}class Lde extends xhe{constructor(e){super(function(e){return(e=e||{}).fillLinearGradientColorStops||e.fillRadialGradientColorStops||e.fillPatternImage||(e.fill=e.fill||"black"),e}(e)),this._partialTextX=0,this._partialTextY=0;for(var t=0;t<Vde;t++)this.on(Hde[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(e){var t=this.textArr,n=t.length;if(this.text()){var r,a=this.padding(),o=this.fontSize(),c=this.lineHeight()*o,i=this.verticalAlign(),l=0,s=this.align(),h=this.getWidth(),d=this.letterSpacing(),u=this.fill(),m=this.textDecoration(),p=-1!==m.indexOf("underline"),v=-1!==m.indexOf("line-through"),f=0,z=(f=c/2,0),g=0;for(e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",yde),e.setAttr("textAlign",gde),i===yde?l=(this.getHeight()-n*c-2*a)/2:"bottom"===i&&(l=this.getHeight()-n*c-2*a),e.translate(a,l+a),r=0;r<n;r++){z=0,g=0;var y,M,E,b=t[r],H=b.text,V=b.width,C=b.lastInParagraph;if(e.save(),"right"===s?z+=h-V-2*a:"center"===s&&(z+=(h-V-2*a)/2),p){e.save(),e.beginPath(),e.moveTo(z,f+g+Math.round(o/2)),M=0==(y=H.split(" ").length-1),E=s!==zde||C?V:h-2*a,e.lineTo(z+Math.round(E),f+g+Math.round(o/2)),e.lineWidth=o/15;const t=this._getLinearGradient();e.strokeStyle=t||u,e.stroke(),e.restore()}if(v){e.save(),e.beginPath(),e.moveTo(z,f+g),M=0==(y=H.split(" ").length-1),E=s===zde&&C&&!M?h-2*a:V,e.lineTo(z+Math.round(E),f+g),e.lineWidth=o/15;const t=this._getLinearGradient();e.strokeStyle=t||u,e.stroke(),e.restore()}if(0!==d||s===zde){y=H.split(" ").length-1;for(var L=pde(H),k=0;k<L.length;k++){var w=L[k];" "!==w||C||s!==zde||(z+=(h-2*a-V)/y),this._partialTextX=z,this._partialTextY=f+g,this._partialText=w,e.fillStrokeShape(this),z+=this.measureSize(w).width+d}}else this._partialTextX=z,this._partialTextY=f+g,this._partialText=H,e.fillStrokeShape(this);e.restore(),n>1&&(f+=c)}}}_hitFunc(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){var t=rse._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===fde||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===fde||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return rse.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n=Cde(),r=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{width:t.width,height:r}}_getContextFont(){return this.fontStyle()+Ede+this.fontVariant()+Ede+(this.fontSize()+"px ")+function(e){return e.split(",").map((e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e})).join(", ")}(this.fontFamily())}_addTextLine(e){this.align()===zde&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var t=this.letterSpacing(),n=e.length;return Cde().measureText(e).width+(n?t*(n-1):0)}_setTextData(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,r=this.lineHeight()*t,a=this.attrs.width,o=this.attrs.height,c=a!==fde&&void 0!==a,i=o!==fde&&void 0!==o,l=this.padding(),s=a-2*l,h=o-2*l,d=0,u=this.wrap(),m="char"!==u&&u!==bde,p=this.ellipsis();this.textArr=[],Cde().font=this._getContextFont();for(var v=p?this._getTextWidth("…"):0,f=0,z=e.length;f<z;++f){var g=e[f],y=this._getTextWidth(g);if(c&&y>s)for(;g.length>0;){for(var M=0,E=g.length,b="",H=0;M<E;){var V=M+E>>>1,C=g.slice(0,V+1),L=this._getTextWidth(C)+v;L<=s?(M=V+1,b=C,H=L):E=V}if(!b)break;if(m){var k,w=g[b.length];(k=(w===Ede||"-"===w)&&H<=s?b.length:Math.max(b.lastIndexOf(Ede),b.lastIndexOf("-"))+1)>0&&(M=k,b=b.slice(0,M),H=this._getTextWidth(b))}if(b=b.trimRight(),this._addTextLine(b),n=Math.max(n,H),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if((g=(g=g.slice(M)).trimLeft()).length>0&&(y=this._getTextWidth(g))<=s){this._addTextLine(g),d+=r,n=Math.max(n,y);break}}else this._addTextLine(g),d+=r,n=Math.max(n,y),this._shouldHandleEllipsis(d)&&f<z-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),i&&d+r>h)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){var t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,a=r!==fde&&void 0!==r,o=r-2*this.padding();return!(this.wrap()!==bde)||a&&e+n>o}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,t=e!==fde&&void 0!==e,n=e-2*this.padding(),r=this.ellipsis(),a=this.textArr[this.textArr.length-1];a&&r&&(t&&(this._getTextWidth(a.text+"…")<n||(a.text=a.text.slice(0,a.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+"…"))}getStrokeScaleEnabled(){return!0}}Lde.prototype._fillFunc=function(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)},Lde.prototype._strokeFunc=function(e){e.strokeText(this._partialText,this._partialTextX,this._partialTextY)},Lde.prototype.className="Text",Lde.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],Yle(Lde),pse.overWriteSetter(Lde,"width",lse()),pse.overWriteSetter(Lde,"height",lse()),pse.addGetterSetter(Lde,"fontFamily","Arial"),pse.addGetterSetter(Lde,"fontSize",12,cse()),pse.addGetterSetter(Lde,"fontStyle",Mde),pse.addGetterSetter(Lde,"fontVariant",Mde),pse.addGetterSetter(Lde,"padding",0,cse()),pse.addGetterSetter(Lde,"align",gde),pse.addGetterSetter(Lde,"verticalAlign","top"),pse.addGetterSetter(Lde,"lineHeight",1,cse()),pse.addGetterSetter(Lde,"wrap","word"),pse.addGetterSetter(Lde,"ellipsis",!1,dse()),pse.addGetterSetter(Lde,"letterSpacing",0,cse()),pse.addGetterSetter(Lde,"text","",sse()),pse.addGetterSetter(Lde,"textDecoration","");var kde="normal";function wde(e){e.fillText(this.partialText,0,0)}function Sde(e){e.strokeText(this.partialText,0,0)}class xde extends xhe{constructor(e){super(e),this.dummyCanvas=rse.createCanvasElement(),this.dataArray=[],this.dataArray=Khe.parsePathData(this.attrs.data),this.on("dataChange.konva",(function(){this.dataArray=Khe.parsePathData(this.attrs.data),this._setTextData()})),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var t=this.textDecoration(),n=this.fill(),r=this.fontSize(),a=this.glyphInfo;"underline"===t&&e.beginPath();for(var o=0;o<a.length;o++){e.save();var c=a[o].p0;e.translate(c.x,c.y),e.rotate(a[o].rotation),this.partialText=a[o].text,e.fillStrokeShape(this),"underline"===t&&(0===o&&e.moveTo(0,r/2+1),e.lineTo(r,r/2+1)),e.restore()}"underline"===t&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),e.restore()}_hitFunc(e){e.beginPath();var t=this.glyphInfo;if(t.length>=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var r=0;r<t.length;r++){var a=t[r].p1;e.lineTo(a.x,a.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return rse.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Lde.prototype.setText.call(this,e)}_getContextFont(){return Lde.prototype._getContextFont.call(this)}_getTextSize(e){var t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();var n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(this.attrs.fontSize,10)}}_setTextData(){var e=this,t=this._getTextSize(this.attrs.text),n=this.letterSpacing(),r=this.align(),a=this.kerningFunc();this.textWidth=t.width,this.textHeight=t.height;var o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);this.glyphInfo=[];for(var c=0,i=0;i<e.dataArray.length;i++)e.dataArray[i].pathLength>0&&(c+=e.dataArray[i].pathLength);var l=0;"center"===r&&(l=Math.max(0,c/2-o/2)),"right"===r&&(l=Math.max(0,c-o));for(var s,h,d,u=pde(this.text()),m=this.text().split(" ").length-1,p=-1,v=0,f=function(){v=0;for(var t=e.dataArray,n=p+1;n<t.length;n++){if(t[n].pathLength>0)return p=n,t[n];"M"===t[n].command&&(s={x:t[n].points[0],y:t[n].points[1]})}return{}},z=function(t){var a=e._getTextSize(t).width+n;" "===t&&"justify"===r&&(a+=(c-o)/m);var i=0,l=0;for(h=void 0;Math.abs(a-i)/a>.01&&l<20;){l++;for(var u=i;void 0===d;)(d=f())&&u+d.pathLength<a&&(u+=d.pathLength,d=void 0);if(0===Object.keys(d).length||void 0===s)return;var p=!1;switch(d.command){case"L":Khe.getLineLength(s.x,s.y,d.points[0],d.points[1])>a?h=Khe.getPointOnLine(a,s.x,s.y,d.points[0],d.points[1],s.x,s.y):d=void 0;break;case"A":var z=d.points[4],g=d.points[5],y=d.points[4]+g;0===v?v=z+1e-8:a>i?v+=Math.PI/180*g/Math.abs(g):v-=Math.PI/360*g/Math.abs(g),(g<0&&v<y||g>=0&&v>y)&&(v=y,p=!0),h=Khe.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],v,d.points[6]);break;case"C":0===v?v=a>d.pathLength?1e-8:a/d.pathLength:a>i?v+=(a-i)/d.pathLength/2:v=Math.max(v-(i-a)/d.pathLength/2,0),v>1&&(v=1,p=!0),h=Khe.getPointOnCubicBezier(v,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3],d.points[4],d.points[5]);break;case"Q":0===v?v=a/d.pathLength:a>i?v+=(a-i)/d.pathLength:v-=(i-a)/d.pathLength,v>1&&(v=1,p=!0),h=Khe.getPointOnQuadraticBezier(v,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3])}void 0!==h&&(i=Khe.getLineLength(s.x,s.y,h.x,h.y)),p&&(p=!1,d=void 0)}},g=l/(e._getTextSize("C").width+n)-1,y=0;y<g&&(z("C"),void 0!==s&&void 0!==h);y++)s=h;for(var M=0;M<u.length&&(z(u[M]),void 0!==s&&void 0!==h);M++){var E=Khe.getLineLength(s.x,s.y,h.x,h.y),b=0;if(a)try{b=a(u[M-1],u[M])*this.fontSize()}catch(e){b=0}s.x+=b,h.x+=b,this.textWidth+=b;var H=Khe.getPointOnLine(b+E/2,s.x,s.y,h.x,h.y),V=Math.atan2(h.y-s.y,h.x-s.x);this.glyphInfo.push({transposeX:H.x,transposeY:H.y,text:u[M],rotation:V,p0:s,p1:h}),s=h}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var e=[];this.glyphInfo.forEach((function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)}));for(var t,n,r=e[0]||0,a=e[0]||0,o=e[1]||0,c=e[1]||0,i=0;i<e.length/2;i++)t=e[2*i],n=e[2*i+1],r=Math.min(r,t),a=Math.max(a,t),o=Math.min(o,n),c=Math.max(c,n);var l=this.fontSize();return{x:r-l/2,y:o-l/2,width:a-r+l,height:c-o+l}}destroy(){return rse.releaseCanvas(this.dummyCanvas),super.destroy()}}xde.prototype._fillFunc=wde,xde.prototype._strokeFunc=Sde,xde.prototype._fillFuncHit=wde,xde.prototype._strokeFuncHit=Sde,xde.prototype.className="TextPath",xde.prototype._attrsAffectingSize=["text","fontSize","data"],Yle(xde),pse.addGetterSetter(xde,"data"),pse.addGetterSetter(xde,"fontFamily","Arial"),pse.addGetterSetter(xde,"fontSize",12,cse()),pse.addGetterSetter(xde,"fontStyle",kde),pse.addGetterSetter(xde,"align","left"),pse.addGetterSetter(xde,"letterSpacing",0,cse()),pse.addGetterSetter(xde,"textBaseline","middle"),pse.addGetterSetter(xde,"fontVariant",kde),pse.addGetterSetter(xde,"text",""),pse.addGetterSetter(xde,"textDecoration",null),pse.addGetterSetter(xde,"kerningFunc",null);var Tde="tr-konva",Ode=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange"].map((e=>e+`.${Tde}`)).join(" "),Ade="nodesRect",Rde=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Nde={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const _de="ontouchstart"in Gle._global;var Dde=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function Pde(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),a=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:a})}class Fde extends Nhe{constructor(e){super(e),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Ode,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return rse.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Tde+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter((e=>!e.isAncestorOf(this)||(rse.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1)));return this._nodes=e=t,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((e=>{const t=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=e._attrsAffectingSize.map((e=>e+"Change."+this._getEventNamespace())).join(" ");e.on(n,t),e.on(Rde.map((e=>e+`.${this._getEventNamespace()}`)).join(" "),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)})),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,(n=>{t=e.getAbsolutePosition(),this.isDragging()||e===this.findOne(".back")||this.startDrag(n,!1)})),e.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!t)return;const r=e.getAbsolutePosition(),a=r.x-t.x,o=r.y-t.y;this.nodes().forEach((t=>{if(t===e)return;if(t.isDragging())return;const r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+a,y:r.y+o}),t.startDrag(n)})),t=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((e=>{e.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Ade),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Ade,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){var r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(n),o=e.getAbsolutePosition(n),c=r.x*a.x-e.offsetX()*a.x,i=r.y*a.y-e.offsetY()*a.y;const l=(Gle.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return Pde({x:o.x+c*Math.cos(l)+i*Math.sin(-l),y:o.y+i*Math.cos(l)+c*Math.sin(l),width:r.width*a.x,height:r.height*a.y,rotation:l},-Gle.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map((t=>{const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],a=t.getAbsoluteTransform();r.forEach((function(t){var n=a.point(t);e.push(n)}))}));const t=new Kle;var n,r,a,o;t.rotate(-Gle.getAngle(this.rotation())),e.forEach((function(e){var c=t.point(e);void 0===n&&(n=a=c.x,r=o=c.y),n=Math.min(n,c.x),r=Math.min(r,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)})),t.invert();const c=t.point({x:n,y:r});return{x:c.x,y:c.y,width:a-n,height:o-r,rotation:Gle.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Dde.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var t=new lde({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:_de?10:"auto"}),n=this;t.on("mousedown touchstart",(function(e){n._handleMouseDown(e)})),t.on("dragstart",(e=>{t.stopDrag(),e.cancelBubble=!0})),t.on("dragend",(e=>{e.cancelBubble=!0})),t.on("mouseenter",(()=>{var n=Gle.getAngle(this.rotation()),r=function(e,t){if("rotater"===e)return"crosshair";t+=rse.degToRad(Nde[e]||0);var n=(rse.radToDeg(t)%360+360)%360;return rse._inRange(n,337.5,360)||rse._inRange(n,0,22.5)?"ns-resize":rse._inRange(n,22.5,67.5)?"nesw-resize":rse._inRange(n,67.5,112.5)?"ew-resize":rse._inRange(n,112.5,157.5)?"nwse-resize":rse._inRange(n,157.5,202.5)?"ns-resize":rse._inRange(n,202.5,247.5)?"nesw-resize":rse._inRange(n,247.5,292.5)?"ew-resize":rse._inRange(n,292.5,337.5)?"nwse-resize":(rse.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(e,n);t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0})),t.on("mouseout",(()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(t)}_createBack(){var e=new xhe({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var t=this.getParent(),n=t.padding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),t.rotateEnabled()&&e.lineTo(this.width()/2,-t.rotateAnchorOffset()*rse._sign(this.height())-n),e.fillStrokeShape(this)},hitFunc:(e,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+2*n,t.height()+2*n),e.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",(e=>{e.cancelBubble=!0})),e.on("dragmove",(e=>{e.cancelBubble=!0})),e.on("dragend",(e=>{e.cancelBubble=!0})),this.on("dragmove",(e=>{this.update()}))}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,r=t.height,a=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/a),this.cos=Math.abs(n/a),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var o=e.target.getAbsolutePosition(),c=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:c.x-o.x,y:c.y-o.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((t=>{t._fire("transformstart",{evt:e.evt,target:t})}))}_handleMouseMove(e){var t,n,r,a=this.findOne("."+this._movingAnchorName),o=a.getStage();o.setPointersPositions(e);const c=o.getPointerPosition();let i={x:c.x-this._anchorDragOffset.x,y:c.y-this._anchorDragOffset.y};const l=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(i=this.anchorDragBoundFunc()(l,i,e)),a.setAbsolutePosition(i);const s=a.getAbsolutePosition();if(l.x!==s.x||l.y!==s.y)if("rotater"!==this._movingAnchorName){var h=this.keepRatio()||e.shiftKey,d=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(h){var u=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(u.x-a.x(),2)+Math.pow(u.y-a.y(),2));var m=this.findOne(".top-left").x()>u.x?-1:1,p=this.findOne(".top-left").y()>u.y?-1:1;t=r*this.cos*m,n=r*this.sin*p,this.findOne(".top-left").x(u.x-t),this.findOne(".top-left").y(u.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(a.y());else if("top-right"===this._movingAnchorName){h&&(u=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()},r=Math.sqrt(Math.pow(a.x()-u.x,2)+Math.pow(u.y-a.y(),2)),m=this.findOne(".top-right").x()<u.x?-1:1,p=this.findOne(".top-right").y()>u.y?-1:1,t=r*this.cos*m,n=r*this.sin*p,this.findOne(".top-right").x(u.x+t),this.findOne(".top-right").y(u.y-n));var v=a.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else"middle-left"===this._movingAnchorName?this.findOne(".top-left").x(a.x()):"middle-right"===this._movingAnchorName?this.findOne(".bottom-right").x(a.x()):"bottom-left"===this._movingAnchorName?(h&&(u=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()},r=Math.sqrt(Math.pow(u.x-a.x(),2)+Math.pow(a.y()-u.y,2)),m=u.x<a.x()?-1:1,p=a.y()<u.y?-1:1,t=r*this.cos*m,n=r*this.sin*p,a.x(u.x-t),a.y(u.y+n)),v=a.position(),this.findOne(".top-left").x(v.x),this.findOne(".bottom-right").y(v.y)):"bottom-center"===this._movingAnchorName?this.findOne(".bottom-right").y(a.y()):"bottom-right"===this._movingAnchorName?h&&(u=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()},r=Math.sqrt(Math.pow(a.x()-u.x,2)+Math.pow(a.y()-u.y,2)),m=this.findOne(".bottom-right").x()<u.x?-1:1,p=this.findOne(".bottom-right").y()<u.y?-1:1,t=r*this.cos*m,n=r*this.sin*p,this.findOne(".bottom-right").x(u.x+t),this.findOne(".bottom-right").y(u.y+n)):console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(d=this.centeredScaling()||e.altKey){var f=this.findOne(".top-left"),z=this.findOne(".bottom-right"),g=f.x(),y=f.y(),M=this.getWidth()-z.x(),E=this.getHeight()-z.y();z.move({x:-g,y:-y}),f.move({x:M,y:E})}var b=this.findOne(".top-left").getAbsolutePosition();t=b.x,n=b.y;var H=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),V=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:H,height:V,rotation:Gle.getAngle(this.rotation())},e)}else{var C=this._getNodeRect();t=a.x()-C.width/2,n=-a.y()+C.height/2;let r=Math.atan2(-n,t)+Math.PI/2;C.height<0&&(r-=Math.PI);const o=Gle.getAngle(this.rotation())+r,c=Gle.getAngle(this.rotationSnapTolerance()),i=function(e,t){const n=function(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}(e);return Pde(e,t,n)}(C,function(e,t,n){let r=t;for(let a=0;a<e.length;a++){const o=Gle.getAngle(e[a]),c=Math.abs(o-t)%(2*Math.PI);Math.min(c,2*Math.PI-c)<n&&(r=o)}return r}(this.rotationSnaps(),o,c)-C.rotation);this._fitNodesInto(i,e)}}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var t=this.getNode();this._fire("transformend",{evt:e,target:t}),t&&this._nodes.forEach((t=>{t._fire("transformend",{evt:e,target:t})})),this._movingAnchorName=null}}_fitNodesInto(e,t){var n=this._getNodeRect();if(rse._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(rse._inRange(e.height,2*-this.padding()-1,1))return void this.update();const r=this.flipEnabled();var a=new Kle;if(a.rotate(Gle.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=a.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!r)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=a.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!r)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=a.point({x:0,y:2*-this.padding()});if(e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=a.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}if(this.boundBoxFunc()){const t=this.boundBoxFunc()(n,e);t?e=t:rse.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,c=new Kle;c.translate(n.x,n.y),c.rotate(n.rotation),c.scale(n.width/o,n.height/o);const i=new Kle;i.translate(e.x,e.y),i.rotate(e.rotation),i.scale(e.width/o,e.height/o);const l=i.multiply(c.invert());this._nodes.forEach((e=>{var n;const r=e.getParent().getAbsoluteTransform(),a=e.getTransform().copy();a.translate(e.offsetX(),e.offsetY());const o=new Kle;o.multiply(r.copy().invert()).multiply(l).multiply(r).multiply(a);const c=o.decompose();e.setAttrs(c),this._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this.rotation(rse._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e,t=this._getNodeRect();this.rotation(rse._getRotation(t.rotation));var n=t.width,r=t.height,a=this.enabledAnchors(),o=this.resizeEnabled(),c=this.padding(),i=this.anchorSize();this.find("._anchor").forEach((e=>{e.setAttrs({width:i,height:i,offsetX:i/2,offsetY:i/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:i/2+c,offsetY:i/2+c,visible:o&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:i/2+c,visible:o&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:i/2-c,offsetY:i/2+c,visible:o&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:i/2+c,visible:o&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:i/2-c,visible:o&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:i/2+c,offsetY:i/2-c,visible:o&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:i/2-c,visible:o&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:i/2-c,offsetY:i/2-c,visible:o&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*rse._sign(r)-c,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Nhe.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Fse.prototype.toObject.call(this)}clone(e){return Fse.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Fde.prototype.className="Transformer",Yle(Fde),pse.addGetterSetter(Fde,"enabledAnchors",Dde,(function(e){return e instanceof Array||rse.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===Dde.indexOf(e)&&rse.warn("Unknown anchor name: "+e+". Available names are: "+Dde.join(", "))})),e||[]})),pse.addGetterSetter(Fde,"flipEnabled",!0,dse()),pse.addGetterSetter(Fde,"resizeEnabled",!0),pse.addGetterSetter(Fde,"anchorSize",10,cse()),pse.addGetterSetter(Fde,"rotateEnabled",!0),pse.addGetterSetter(Fde,"rotationSnaps",[]),pse.addGetterSetter(Fde,"rotateAnchorOffset",50,cse()),pse.addGetterSetter(Fde,"rotationSnapTolerance",5,cse()),pse.addGetterSetter(Fde,"borderEnabled",!0),pse.addGetterSetter(Fde,"anchorStroke","rgb(0, 161, 255)"),pse.addGetterSetter(Fde,"anchorStrokeWidth",1,cse()),pse.addGetterSetter(Fde,"anchorFill","white"),pse.addGetterSetter(Fde,"anchorCornerRadius",0,cse()),pse.addGetterSetter(Fde,"borderStroke","rgb(0, 161, 255)"),pse.addGetterSetter(Fde,"borderStrokeWidth",1,cse()),pse.addGetterSetter(Fde,"borderDash"),pse.addGetterSetter(Fde,"keepRatio",!0),pse.addGetterSetter(Fde,"centeredScaling",!1),pse.addGetterSetter(Fde,"ignoreStroke",!1),pse.addGetterSetter(Fde,"padding",0,cse()),pse.addGetterSetter(Fde,"node"),pse.addGetterSetter(Fde,"nodes"),pse.addGetterSetter(Fde,"boundBoxFunc"),pse.addGetterSetter(Fde,"anchorDragBoundFunc"),pse.addGetterSetter(Fde,"shouldOverdrawWholeArea",!1),pse.addGetterSetter(Fde,"useSingleNodeRotation",!0),pse.backCompat(Fde,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class Ide extends xhe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Gle.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}function Bde(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}Ide.prototype.className="Wedge",Ide.prototype._centroid=!0,Ide.prototype._attrsAffectingSize=["radius"],Yle(Ide),pse.addGetterSetter(Ide,"radius",0,cse()),pse.addGetterSetter(Ide,"angle",0,cse()),pse.addGetterSetter(Ide,"clockwise",!1),pse.backCompat(Ide,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var jde=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Ude=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Wde(e,t,n,r,a){var o=n-t,c=a-r;return 0===o?r+c/2:0===c?r:c*((e-t)/o)+r}function $de(e,t,n){var r=4*(n*e.width+t),a=[];return a.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),a}function qde(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}function Gde(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}pse.addGetterSetter(Fse,"blurRadius",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"brightness",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"contrast",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"embossStrength",.5,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"embossWhiteLevel",.5,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"embossDirection","top-left",null,pse.afterSetFilter),pse.addGetterSetter(Fse,"embossBlend",!1,null,pse.afterSetFilter),pse.addGetterSetter(Fse,"enhance",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"hue",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"saturation",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"luminance",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"hue",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"saturation",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"value",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"kaleidoscopePower",2,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"kaleidoscopeAngle",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"threshold",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"noise",.2,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"pixelSize",8,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"levels",.5,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),pse.addGetterSetter(Fse,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),pse.addGetterSetter(Fse,"blue",0,ose,pse.afterSetFilter),pse.addGetterSetter(Fse,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),pse.addGetterSetter(Fse,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),pse.addGetterSetter(Fse,"blue",0,ose,pse.afterSetFilter),pse.addGetterSetter(Fse,"alpha",1,(function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e})),pse.addGetterSetter(Fse,"threshold",.5,cse(),pse.afterSetFilter),Whe.Util._assign(Whe,{Arc:$he,Arrow:Xhe,Circle:Qhe,Ellipse:Jhe,Image:Zhe,Label:cde,Tag:ide,Line:Yhe,Path:Khe,Rect:lde,RegularPolygon:sde,Ring:dde,Sprite:ude,Star:mde,Text:Lde,TextPath:xde,Transformer:Fde,Wedge:Ide,Filters:{Blur:function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,r,a,o,c,i,l,s,h,d,u,m,p,v,f,z,g,y,M,E,b,H,V,C,L=e.data,k=e.width,w=e.height,S=t+t+1,x=k-1,T=w-1,O=t+1,A=O*(O+1)/2,R=new Bde,N=null,_=R,D=null,P=null,F=jde[t],I=Ude[t];for(a=1;a<S;a++)_=_.next=new Bde,a===O&&(N=_);for(_.next=R,l=i=0,r=0;r<w;r++){for(z=g=y=M=s=h=d=u=0,m=O*(E=L[i]),p=O*(b=L[i+1]),v=O*(H=L[i+2]),f=O*(V=L[i+3]),s+=A*E,h+=A*b,d+=A*H,u+=A*V,_=R,a=0;a<O;a++)_.r=E,_.g=b,_.b=H,_.a=V,_=_.next;for(a=1;a<O;a++)o=i+((x<a?x:a)<<2),s+=(_.r=E=L[o])*(C=O-a),h+=(_.g=b=L[o+1])*C,d+=(_.b=H=L[o+2])*C,u+=(_.a=V=L[o+3])*C,z+=E,g+=b,y+=H,M+=V,_=_.next;for(D=R,P=N,n=0;n<k;n++)L[i+3]=V=u*F>>I,0!==V?(V=255/V,L[i]=(s*F>>I)*V,L[i+1]=(h*F>>I)*V,L[i+2]=(d*F>>I)*V):L[i]=L[i+1]=L[i+2]=0,s-=m,h-=p,d-=v,u-=f,m-=D.r,p-=D.g,v-=D.b,f-=D.a,o=l+((o=n+t+1)<x?o:x)<<2,s+=z+=D.r=L[o],h+=g+=D.g=L[o+1],d+=y+=D.b=L[o+2],u+=M+=D.a=L[o+3],D=D.next,m+=E=P.r,p+=b=P.g,v+=H=P.b,f+=V=P.a,z-=E,g-=b,y-=H,M-=V,P=P.next,i+=4;l+=k}for(n=0;n<k;n++){for(g=y=M=z=h=d=u=s=0,m=O*(E=L[i=n<<2]),p=O*(b=L[i+1]),v=O*(H=L[i+2]),f=O*(V=L[i+3]),s+=A*E,h+=A*b,d+=A*H,u+=A*V,_=R,a=0;a<O;a++)_.r=E,_.g=b,_.b=H,_.a=V,_=_.next;for(c=k,a=1;a<=t;a++)i=c+n<<2,s+=(_.r=E=L[i])*(C=O-a),h+=(_.g=b=L[i+1])*C,d+=(_.b=H=L[i+2])*C,u+=(_.a=V=L[i+3])*C,z+=E,g+=b,y+=H,M+=V,_=_.next,a<T&&(c+=k);for(i=n,D=R,P=N,r=0;r<w;r++)L[3+(o=i<<2)]=V=u*F>>I,V>0?(V=255/V,L[o]=(s*F>>I)*V,L[o+1]=(h*F>>I)*V,L[o+2]=(d*F>>I)*V):L[o]=L[o+1]=L[o+2]=0,s-=m,h-=p,d-=v,u-=f,m-=D.r,p-=D.g,v-=D.b,f-=D.a,o=n+((o=r+O)<T?o:T)*k<<2,s+=z+=D.r=L[o],h+=g+=D.g=L[o+1],d+=y+=D.b=L[o+2],u+=M+=D.a=L[o+3],D=D.next,m+=E=P.r,p+=b=P.g,v+=H=P.b,f+=V=P.a,z-=E,g-=b,y-=H,M-=V,P=P.next,i+=k}}(e,t)},Brighten:function(e){var t,n=255*this.brightness(),r=e.data,a=r.length;for(t=0;t<a;t+=4)r[t]+=n,r[t+1]+=n,r[t+2]+=n},Contrast:function(e){var t,n=Math.pow((this.contrast()+100)/100,2),r=e.data,a=r.length,o=150,c=150,i=150;for(t=0;t<a;t+=4)o=r[t],c=r[t+1],i=r[t+2],o/=255,o-=.5,o*=n,o+=.5,c/=255,c-=.5,c*=n,c+=.5,i/=255,i-=.5,i*=n,i+=.5,o=(o*=255)<0?0:o>255?255:o,c=(c*=255)<0?0:c>255?255:c,i=(i*=255)<0?0:i>255?255:i,r[t]=o,r[t+1]=c,r[t+2]=i},Emboss:function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),a=this.embossBlend(),o=0,c=0,i=e.data,l=e.width,s=e.height,h=4*l,d=s;switch(r){case"top-left":o=-1,c=-1;break;case"top":o=-1,c=0;break;case"top-right":o=-1,c=1;break;case"right":o=0,c=1;break;case"bottom-right":o=1,c=1;break;case"bottom":o=1,c=0;break;case"bottom-left":o=1,c=-1;break;case"left":o=0,c=-1;break;default:rse.error("Unknown emboss direction: "+r)}do{var u=(d-1)*h,m=o;d+m<1&&(m=0),d+m>s&&(m=0);var p=(d-1+m)*l*4,v=l;do{var f=u+4*(v-1),z=c;v+z<1&&(z=0),v+z>l&&(z=0);var g=p+4*(v-1+z),y=i[f]-i[g],M=i[f+1]-i[g+1],E=i[f+2]-i[g+2],b=y,H=b>0?b:-b;if((M>0?M:-M)>H&&(b=M),(E>0?E:-E)>H&&(b=E),b*=t,a){var V=i[f]+b,C=i[f+1]+b,L=i[f+2]+b;i[f]=V>255?255:V<0?0:V,i[f+1]=C>255?255:C<0?0:C,i[f+2]=L>255?255:L<0?0:L}else{var k=n-b;k<0?k=0:k>255&&(k=255),i[f]=i[f+1]=i[f+2]=k}}while(--v)}while(--d)},Enhance:function(e){var t,n,r,a,o=e.data,c=o.length,i=o[0],l=i,s=o[1],h=s,d=o[2],u=d,m=this.enhance();if(0!==m){for(a=0;a<c;a+=4)(t=o[a+0])<i?i=t:t>l&&(l=t),(n=o[a+1])<s?s=n:n>h&&(h=n),(r=o[a+2])<d?d=r:r>u&&(u=r);var p,v,f,z,g,y,M,E,b;for(l===i&&(l=255,i=0),h===s&&(h=255,s=0),u===d&&(u=255,d=0),m>0?(v=l+m*(255-l),f=i-m*(i-0),g=h+m*(255-h),y=s-m*(s-0),E=u+m*(255-u),b=d-m*(d-0)):(v=l+m*(l-(p=.5*(l+i))),f=i+m*(i-p),g=h+m*(h-(z=.5*(h+s))),y=s+m*(s-z),E=u+m*(u-(M=.5*(u+d))),b=d+m*(d-M)),a=0;a<c;a+=4)o[a+0]=Wde(o[a+0],i,l,f,v),o[a+1]=Wde(o[a+1],s,h,y,g),o[a+2]=Wde(o[a+2],d,u,b,E)}},Grayscale:function(e){var t,n,r=e.data,a=r.length;for(t=0;t<a;t+=4)n=.34*r[t]+.5*r[t+1]+.16*r[t+2],r[t]=n,r[t+1]=n,r[t+2]=n},HSL:function(e){var t,n,r,a,o,c=e.data,i=c.length,l=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,h=127*this.luminance(),d=1*l*Math.cos(s*Math.PI/180),u=1*l*Math.sin(s*Math.PI/180),m=.299+.701*d+.167*u,p=.587-.587*d+.33*u,v=.114-.114*d-.497*u,f=.299-.299*d-.328*u,z=.587+.413*d+.035*u,g=.114-.114*d+.293*u,y=.299-.3*d+1.25*u,M=.587-.586*d-1.05*u,E=.114+.886*d-.2*u;for(t=0;t<i;t+=4)n=c[t+0],r=c[t+1],a=c[t+2],o=c[t+3],c[t+0]=m*n+p*r+v*a+h,c[t+1]=f*n+z*r+g*a+h,c[t+2]=y*n+M*r+E*a+h,c[t+3]=o},HSV:function(e){var t,n,r,a,o,c=e.data,i=c.length,l=Math.pow(2,this.value()),s=Math.pow(2,this.saturation()),h=Math.abs(this.hue()+360)%360,d=l*s*Math.cos(h*Math.PI/180),u=l*s*Math.sin(h*Math.PI/180),m=.299*l+.701*d+.167*u,p=.587*l-.587*d+.33*u,v=.114*l-.114*d-.497*u,f=.299*l-.299*d-.328*u,z=.587*l+.413*d+.035*u,g=.114*l-.114*d+.293*u,y=.299*l-.3*d+1.25*u,M=.587*l-.586*d-1.05*u,E=.114*l+.886*d-.2*u;for(t=0;t<i;t+=4)n=c[t+0],r=c[t+1],a=c[t+2],o=c[t+3],c[t+0]=m*n+p*r+v*a,c[t+1]=f*n+z*r+g*a,c[t+2]=y*n+M*r+E*a,c[t+3]=o},Invert:function(e){var t,n=e.data,r=n.length;for(t=0;t<r;t+=4)n[t]=255-n[t],n[t+1]=255-n[t+1],n[t+2]=255-n[t+2]},Kaleidoscope:function(e){var t,n,r,a,o,c,i,l,s,h=e.width,d=e.height,u=Math.round(this.kaleidoscopePower()),m=Math.round(this.kaleidoscopeAngle()),p=Math.floor(h*(m%360)/360);if(!(u<1)){var v=rse.createCanvasElement();v.width=h,v.height=d;var f=v.getContext("2d").getImageData(0,0,h,d);rse.releaseCanvas(v),function(e,t,n){var r,a,o,c,i=e.data,l=t.data,s=e.width,h=e.height,d=n.polarCenterX||s/2,u=n.polarCenterY||h/2,m=0,p=0,v=0,f=0,z=Math.sqrt(d*d+u*u);a=s-d,o=h-u,z=(c=Math.sqrt(a*a+o*o))>z?c:z;var g,y,M,E,b=h,H=s,V=360/H*Math.PI/180;for(y=0;y<H;y+=1)for(M=Math.sin(y*V),E=Math.cos(y*V),g=0;g<b;g+=1)a=Math.floor(d+z*g/b*E),m=i[0+(r=4*((o=Math.floor(u+z*g/b*M))*s+a))],p=i[r+1],v=i[r+2],f=i[r+3],l[0+(r=4*(y+g*s))]=m,l[r+1]=p,l[r+2]=v,l[r+3]=f}(e,f,{polarCenterX:h/2,polarCenterY:d/2});for(var z=h/Math.pow(2,u);z<=8;)z*=2,u-=1;var g=z=Math.ceil(z),y=0,M=g,E=1;for(p+z>h&&(y=g,M=0,E=-1),n=0;n<d;n+=1)for(t=y;t!==M;t+=E)l=4*(h*n+Math.round(t+p)%h),a=f.data[l+0],o=f.data[l+1],c=f.data[l+2],i=f.data[l+3],s=4*(h*n+t),f.data[s+0]=a,f.data[s+1]=o,f.data[s+2]=c,f.data[s+3]=i;for(n=0;n<d;n+=1)for(g=Math.floor(z),r=0;r<u;r+=1){for(t=0;t<g+1;t+=1)l=4*(h*n+t),a=f.data[l+0],o=f.data[l+1],c=f.data[l+2],i=f.data[l+3],s=4*(h*n+2*g-t-1),f.data[s+0]=a,f.data[s+1]=o,f.data[s+2]=c,f.data[s+3]=i;g*=2}!function(e,t,n){var r,a,o,c,i,l,s=e.data,h=t.data,d=e.width,u=e.height,m=n.polarCenterX||d/2,p=n.polarCenterY||u/2,v=0,f=0,z=0,g=0,y=Math.sqrt(m*m+p*p);a=d-m,o=u-p,y=(l=Math.sqrt(a*a+o*o))>y?l:y;var M,E,b,H=u,V=d,C=n.polarRotation||0;for(a=0;a<d;a+=1)for(o=0;o<u;o+=1)c=a-m,i=o-p,M=Math.sqrt(c*c+i*i)*H/y,E=(E=(180*Math.atan2(i,c)/Math.PI+360+C)%360)*V/360,b=Math.floor(E),v=s[0+(r=4*(Math.floor(M)*d+b))],f=s[r+1],z=s[r+2],g=s[r+3],h[0+(r=4*(o*d+a))]=v,h[r+1]=f,h[r+2]=z,h[r+3]=g}(f,e,{polarRotation:0})}},Mask:function(e){var t=function(e,t){var n=$de(e,0,0),r=$de(e,e.width-1,0),a=$de(e,0,e.height-1),o=$de(e,e.width-1,e.height-1),c=t||10;if(qde(n,r)<c&&qde(r,o)<c&&qde(o,a)<c&&qde(a,n)<c){for(var i=function(e){for(var t=[0,0,0],n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}([r,n,o,a]),l=[],s=0;s<e.width*e.height;s++){var h=qde(i,[e.data[4*s],e.data[4*s+1],e.data[4*s+2]]);l[s]=h<c?0:255}return l}}(e,this.threshold());return t&&function(e,t){for(var n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}(e,t=function(e,t,n){for(var r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),c=[],i=0;i<n;i++)for(var l=0;l<t;l++){for(var s=i*t+l,h=0,d=0;d<a;d++)for(var u=0;u<a;u++){var m=i+d-o,p=l+u-o;if(m>=0&&m<n&&p>=0&&p<t){var v=r[d*a+u];h+=e[m*t+p]*v}}c[s]=h}return c}(t=function(e,t,n){for(var r=[1,1,1,1,1,1,1,1,1],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),c=[],i=0;i<n;i++)for(var l=0;l<t;l++){for(var s=i*t+l,h=0,d=0;d<a;d++)for(var u=0;u<a;u++){var m=i+d-o,p=l+u-o;if(m>=0&&m<n&&p>=0&&p<t){var v=r[d*a+u];h+=e[m*t+p]*v}}c[s]=h>=1020?255:0}return c}(t=function(e,t,n){for(var r=[1,1,1,1,0,1,1,1,1],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),c=[],i=0;i<n;i++)for(var l=0;l<t;l++){for(var s=i*t+l,h=0,d=0;d<a;d++)for(var u=0;u<a;u++){var m=i+d-o,p=l+u-o;if(m>=0&&m<n&&p>=0&&p<t){var v=r[d*a+u];h+=e[m*t+p]*v}}c[s]=2040===h?255:0}return c}(t,e.width,e.height),e.width,e.height),e.width,e.height)),e},Noise:function(e){var t,n=255*this.noise(),r=e.data,a=r.length,o=n/2;for(t=0;t<a;t+=4)r[t+0]+=o-2*o*Math.random(),r[t+1]+=o-2*o*Math.random(),r[t+2]+=o-2*o*Math.random()},Pixelate:function(e){var t,n,r,a,o,c,i,l,s,h,d,u,m,p,v=Math.ceil(this.pixelSize()),f=e.width,z=e.height,g=Math.ceil(f/v),y=Math.ceil(z/v),M=e.data;if(v<=0)rse.error("pixelSize value can not be <= 0");else for(u=0;u<g;u+=1)for(m=0;m<y;m+=1){for(a=0,o=0,c=0,i=0,s=(l=u*v)+v,d=(h=m*v)+v,p=0,t=l;t<s;t+=1)if(!(t>=f))for(n=h;n<d;n+=1)n>=z||(a+=M[0+(r=4*(f*n+t))],o+=M[r+1],c+=M[r+2],i+=M[r+3],p+=1);for(a/=p,o/=p,c/=p,i/=p,t=l;t<s;t+=1)if(!(t>=f))for(n=h;n<d;n+=1)n>=z||(M[0+(r=4*(f*n+t))]=a,M[r+1]=o,M[r+2]=c,M[r+3]=i)}},Posterize:function(e){var t,n=Math.round(254*this.levels())+1,r=e.data,a=r.length,o=255/n;for(t=0;t<a;t+=1)r[t]=Math.floor(r[t]/o)*o},RGB:function(e){var t,n,r=e.data,a=r.length,o=this.red(),c=this.green(),i=this.blue();for(t=0;t<a;t+=4)n=(.34*r[t]+.5*r[t+1]+.16*r[t+2])/255,r[t]=n*o,r[t+1]=n*c,r[t+2]=n*i,r[t+3]=r[t+3]},RGBA:function(e){var t,n,r=e.data,a=r.length,o=this.red(),c=this.green(),i=this.blue(),l=this.alpha();for(t=0;t<a;t+=4)n=1-l,r[t]=o*l+r[t]*n,r[t+1]=c*l+r[t+1]*n,r[t+2]=i*l+r[t+2]*n},Sepia:function(e){var t,n,r,a,o=e.data,c=o.length;for(t=0;t<c;t+=4)n=o[t+0],r=o[t+1],a=o[t+2],o[t+0]=Math.min(255,.393*n+.769*r+.189*a),o[t+1]=Math.min(255,.349*n+.686*r+.168*a),o[t+2]=Math.min(255,.272*n+.534*r+.131*a)},Solarize:function(e){var t=e.data,n=e.width,r=4*n,a=e.height;do{var o=(a-1)*r,c=n;do{var i=o+4*(c-1),l=t[i],s=t[i+1],h=t[i+2];l>127&&(l=255-l),s>127&&(s=255-s),h>127&&(h=255-h),t[i]=l,t[i+1]=s,t[i+2]=h}while(--c)}while(--a)},Threshold:function(e){var t,n=255*this.threshold(),r=e.data,a=r.length;for(t=0;t<a;t+=1)r[t]=r[t]<n?0:255}}});var Yde,Kde,Xde={exports:{}},Qde={exports:{}};function Jde(){if(Kde)return Yde;Kde=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return Yde=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,a){for(var o,c,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),l=1;l<arguments.length;l++){for(var s in o=Object(arguments[l]))t.call(o,s)&&(i[s]=o[s]);if(e){c=e(o);for(var h=0;h<c.length;h++)n.call(o,c[h])&&(i[c[h]]=o[c[h]])}}return i},Yde}var Zde,eue,tue,nue,rue={exports:{}},aue={},oue={};function cue(){return tue||(tue=1,"production"===bee.env.NODE_ENV?rue.exports=(Zde||(Zde=1,function(e){var t,n,r,a;if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,i=c.now();e.unstable_now=function(){return c.now()-i}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var l=null,s=null,h=function(){if(null!==l)try{var t=e.unstable_now();l(!0,t),l=null}catch(e){throw setTimeout(h,0),e}};t=function(e){null!==l?setTimeout(t,0,e):(l=e,setTimeout(h,0))},n=function(e,t){s=setTimeout(e,t)},r=function(){clearTimeout(s)},e.unstable_shouldYield=function(){return!1},a=e.unstable_forceFrameRate=function(){}}else{var d=window.setTimeout,u=window.clearTimeout;if("undefined"!=typeof console){var m=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof m&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var p=!1,v=null,f=-1,z=5,g=0;e.unstable_shouldYield=function(){return e.unstable_now()>=g},a=function(){},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<e?Math.floor(1e3/e):5};var y=new MessageChannel,M=y.port2;y.port1.onmessage=function(){if(null!==v){var t=e.unstable_now();g=t+z;try{v(!0,t)?M.postMessage(null):(p=!1,v=null)}catch(e){throw M.postMessage(null),e}}else p=!1},t=function(e){v=e,p||(p=!0,M.postMessage(null))},n=function(t,n){f=d((function(){t(e.unstable_now())}),n)},r=function(){u(f),f=-1}}function E(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,a=e[r];if(!(void 0!==a&&0<V(a,t)))break e;e[r]=t,e[n]=a,n=r}}function b(e){return void 0===(e=e[0])?null:e}function H(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length;r<a;){var o=2*(r+1)-1,c=e[o],i=o+1,l=e[i];if(void 0!==c&&0>V(c,n))void 0!==l&&0>V(l,c)?(e[r]=l,e[i]=n,r=i):(e[r]=c,e[o]=n,r=o);else{if(!(void 0!==l&&0>V(l,n)))break e;e[r]=l,e[i]=n,r=i}}}return t}return null}function V(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var C=[],L=[],k=1,w=null,S=3,x=!1,T=!1,O=!1;function A(e){for(var t=b(L);null!==t;){if(null===t.callback)H(L);else{if(!(t.startTime<=e))break;H(L),t.sortIndex=t.expirationTime,E(C,t)}t=b(L)}}function R(e){if(O=!1,A(e),!T)if(null!==b(C))T=!0,t(N);else{var r=b(L);null!==r&&n(R,r.startTime-e)}}function N(t,a){T=!1,O&&(O=!1,r()),x=!0;var o=S;try{for(A(a),w=b(C);null!==w&&(!(w.expirationTime>a)||t&&!e.unstable_shouldYield());){var c=w.callback;if("function"==typeof c){w.callback=null,S=w.priorityLevel;var i=c(w.expirationTime<=a);a=e.unstable_now(),"function"==typeof i?w.callback=i:w===b(C)&&H(C),A(a)}else H(C);w=b(C)}if(null!==w)var l=!0;else{var s=b(L);null!==s&&n(R,s.startTime-a),l=!1}return l}finally{w=null,S=o,x=!1}}var _=a;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){T||x||(T=!0,t(N))},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_getFirstCallbackNode=function(){return b(C)},e.unstable_next=function(e){switch(S){case 1:case 2:case 3:var t=3;break;default:t=S}var n=S;S=t;try{return e()}finally{S=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=_,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=S;S=e;try{return t()}finally{S=n}},e.unstable_scheduleCallback=function(a,o,c){var i=e.unstable_now();switch(c="object"==typeof c&&null!==c&&"number"==typeof(c=c.delay)&&0<c?i+c:i,a){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return a={id:k++,callback:o,priorityLevel:a,startTime:c,expirationTime:l=c+l,sortIndex:-1},c>i?(a.sortIndex=c,E(L,a),null===b(C)&&a===b(L)&&(O?r():O=!0,n(R,c-i))):(a.sortIndex=l,E(C,a),T||x||(T=!0,t(N))),a},e.unstable_wrapCallback=function(e){var t=S;return function(){var n=S;S=t;try{return e.apply(this,arguments)}finally{S=n}}}}(aue)),aue):rue.exports=function(){return eue||(eue=1,e=oue,"production"!==bee.env.NODE_ENV&&function(){var t,n,r,a;if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,i=c.now();e.unstable_now=function(){return c.now()-i}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var l=null,s=null,h=function(){if(null!==l)try{var t=e.unstable_now();l(!0,t),l=null}catch(e){throw setTimeout(h,0),e}};t=function(e){null!==l?setTimeout(t,0,e):(l=e,setTimeout(h,0))},n=function(e,t){s=setTimeout(e,t)},r=function(){clearTimeout(s)},e.unstable_shouldYield=function(){return!1},a=e.unstable_forceFrameRate=function(){}}else{var d=window.setTimeout,u=window.clearTimeout;if("undefined"!=typeof console){var m=window.requestAnimationFrame,p=window.cancelAnimationFrame;"function"!=typeof m&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var v=!1,f=null,z=-1,g=5,y=0;e.unstable_shouldYield=function(){return e.unstable_now()>=y},a=function(){},e.unstable_forceFrameRate=function(e){e<0||e>125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):g=e>0?Math.floor(1e3/e):5};var M=new MessageChannel,E=M.port2;M.port1.onmessage=function(){if(null!==f){var t=e.unstable_now();y=t+g;try{f(!0,t)?E.postMessage(null):(v=!1,f=null)}catch(e){throw E.postMessage(null),e}}else v=!1},t=function(e){f=e,v||(v=!0,E.postMessage(null))},n=function(t,n){z=d((function(){t(e.unstable_now())}),n)},r=function(){u(z),z=-1}}function b(e,t){var n=e.length;e.push(t),function(e,t,n){for(var r=n;;){var a=r-1>>>1,o=e[a];if(!(void 0!==o&&C(o,t)>0))return;e[a]=t,e[r]=o,r=a}}(e,t,n)}function H(e){var t=e[0];return void 0===t?null:t}function V(e){var t=e[0];if(void 0!==t){var n=e.pop();return n!==t&&(e[0]=n,function(e,t){for(var n=0,r=e.length;n<r;){var a=2*(n+1)-1,o=e[a],c=a+1,i=e[c];if(void 0!==o&&C(o,t)<0)void 0!==i&&C(i,o)<0?(e[n]=i,e[c]=t,n=c):(e[n]=o,e[a]=t,n=a);else{if(!(void 0!==i&&C(i,t)<0))return;e[n]=i,e[c]=t,n=c}}}(e,n)),t}return null}function C(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var L=[],k=[],w=1,S=null,x=3,T=!1,O=!1,A=!1;function R(e){for(var t=H(k);null!==t;){if(null===t.callback)V(k);else{if(!(t.startTime<=e))return;V(k),t.sortIndex=t.expirationTime,b(L,t)}t=H(k)}}function N(e){if(A=!1,R(e),!O)if(null!==H(L))O=!0,t(_);else{var r=H(k);null!==r&&n(N,r.startTime-e)}}function _(t,a){O=!1,A&&(A=!1,r()),T=!0;var o=x;try{return function(t,r){var a=r;for(R(a),S=H(L);null!==S&&(!(S.expirationTime>a)||t&&!e.unstable_shouldYield());){var o=S.callback;if("function"==typeof o){S.callback=null,x=S.priorityLevel;var c=o(S.expirationTime<=a);a=e.unstable_now(),"function"==typeof c?S.callback=c:S===H(L)&&V(L),R(a)}else V(L);S=H(L)}if(null!==S)return!0;var i=H(k);return null!==i&&n(N,i.startTime-a),!1}(t,a)}finally{S=null,x=o,T=!1}}var D=a;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){O||T||(O=!0,t(_))},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return H(L)},e.unstable_next=function(e){var t;switch(x){case 1:case 2:case 3:t=3;break;default:t=x}var n=x;x=t;try{return e()}finally{x=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=D,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=x;x=e;try{return t()}finally{x=n}},e.unstable_scheduleCallback=function(a,o,c){var i,l,s=e.unstable_now();if("object"==typeof c&&null!==c){var h=c.delay;i="number"==typeof h&&h>0?s+h:s}else i=s;switch(a){case 1:l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}var d=i+l,u={id:w++,callback:o,priorityLevel:a,startTime:i,expirationTime:d,sortIndex:-1};return i>s?(u.sortIndex=i,b(k,u),null===H(L)&&u===H(k)&&(A?r():A=!0,n(N,i-s))):(u.sortIndex=d,b(L,u),O||T||(O=!0,t(_))),u},e.unstable_wrapCallback=function(e){var t=x;return function(){var n=x;x=t;try{return e.apply(this,arguments)}finally{x=n}}}}()),oue;var e}()),rue.exports}
301
+ const r7=Z8("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),a7=Z8("volume-off",[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]]);Z8("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);Z8("volume",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]]);Z8("vote",[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]]);Z8("wallet-cards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]);Z8("wallet-minimal",[["path",{d:"M17 14h.01",key:"7oqj8z"}],["path",{d:"M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14",key:"u1rqew"}]]);Z8("wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);Z8("wallpaper",[["circle",{cx:"8",cy:"9",r:"2",key:"gjzl9d"}],["path",{d:"m9 17 6.1-6.1a2 2 0 0 1 2.81.01L22 15V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"69xh40"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}]]);Z8("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);Z8("wand",[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]]);Z8("warehouse",[["path",{d:"M18 21V10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v11",key:"pb2vm6"}],["path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 1.132-1.803l7.95-3.974a2 2 0 0 1 1.837 0l7.948 3.974A2 2 0 0 1 22 8z",key:"doq5xv"}],["path",{d:"M6 13h12",key:"yf64js"}],["path",{d:"M6 17h12",key:"1jwigz"}]]);Z8("washing-machine",[["path",{d:"M3 6h3",key:"155dbl"}],["path",{d:"M17 6h.01",key:"e2y6kg"}],["rect",{width:"18",height:"20",x:"3",y:"2",rx:"2",key:"od3kk9"}],["circle",{cx:"12",cy:"13",r:"5",key:"nlbqau"}],["path",{d:"M12 18a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 1 0-5",key:"17lach"}]]);Z8("watch",[["path",{d:"M12 10v2.2l1.6 1",key:"n3r21l"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}]]);Z8("waves-ladder",[["path",{d:"M19 5a2 2 0 0 0-2 2v11",key:"s41o68"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}],["path",{d:"M7 13h10",key:"1rwob1"}],["path",{d:"M7 9h10",key:"12czzb"}],["path",{d:"M9 5a2 2 0 0 0-2 2v11",key:"x0q4gh"}]]);Z8("waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);Z8("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);Z8("webcam",[["circle",{cx:"12",cy:"10",r:"8",key:"1gshiw"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 22h10",key:"10w4w3"}],["path",{d:"M12 22v-4",key:"1utk9m"}]]);Z8("webhook-off",[["path",{d:"M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15",key:"1tvl6x"}],["path",{d:"M9 3.4a4 4 0 0 1 6.52.66",key:"q04jfq"}],["path",{d:"m6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05",key:"azowf0"}],["path",{d:"M20.3 20.3a4 4 0 0 1-2.3.7",key:"5joiws"}],["path",{d:"M18.6 13a4 4 0 0 1 3.357 3.414",key:"cangb8"}],["path",{d:"m12 6 .6 1",key:"tpjl1n"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);Z8("webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);Z8("weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]);Z8("wheat-off",[["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"m16 8-1.17 1.17",key:"1qqm82"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"m8 8-.53.53a3.5 3.5 0 0 0 0 4.94L9 15l1.53-1.53c.55-.55.88-1.25.98-1.97",key:"4wz8re"}],["path",{d:"M10.91 5.26c.15-.26.34-.51.56-.73L13 3l1.53 1.53a3.5 3.5 0 0 1 .28 4.62",key:"rves66"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"m16 16-.53.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.49 3.49 0 0 1 1.97-.98",key:"ak46r"}],["path",{d:"M18.74 13.09c.26-.15.51-.34.73-.56L21 11l-1.53-1.53a3.5 3.5 0 0 0-4.62-.28",key:"1tw520"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);Z8("wheat",[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]]);Z8("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);Z8("wifi-cog",[["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"M2 7.82a15 15 0 0 1 20 0",key:"1ovjuk"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["path",{d:"M5 11.858a10 10 0 0 1 11.5-1.785",key:"3sn16i"}],["path",{d:"M8.5 15.429a5 5 0 0 1 2.413-1.31",key:"1pxovh"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);Z8("wifi-high",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);Z8("wifi-low",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);Z8("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);Z8("wifi-pen",[["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["path",{d:"M5 12.859a10 10 0 0 1 10.5-2.222",key:"rpb7oy"}],["path",{d:"M8.5 16.429a5 5 0 0 1 3-1.406",key:"r8bmzl"}]]);Z8("wifi-zero",[["path",{d:"M12 20h.01",key:"zekei9"}]]);Z8("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);Z8("wind-arrow-down",[["path",{d:"M10 2v8",key:"d4bbey"}],["path",{d:"M12.8 21.6A2 2 0 1 0 14 18H2",key:"19kp1d"}],["path",{d:"M17.5 10a2.5 2.5 0 1 1 2 4H2",key:"19kpjc"}],["path",{d:"m6 6 4 4 4-4",key:"k13n16"}]]);Z8("wine-off",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);Z8("wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);Z8("wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]);Z8("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);Z8("worm",[["path",{d:"m19 12-1.5 3",key:"9bcu4o"}],["path",{d:"M19.63 18.81 22 20",key:"121v98"}],["path",{d:"M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z",key:"1tij6q"}]]);Z8("wrap-text",[["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["path",{d:"M3 18h7",key:"sq21v6"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);Z8("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);Z8("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);Z8("youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);Z8("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);Z8("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);Z8("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);Z8("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);var o7=function(t){var r=t.amplitude,a=t.variant,o=t.isActive,l=t.className,h=void 0===l?"":l,d=t.onClick,u=t.disabled,m=void 0!==u&&u,p=t.isConnecting,v=c(Array(40).fill(4)),f=v[0],z=v[1],g=i(null),y=function(){var e=Math.min(Math.max(r,0),1),t=Math.max(e,.2),n=Array(40).fill(0).map((function(e,n){var r=Math.sin(n+Date.now()/100)+.5*Math.random();return 5+9*Math.abs(r)*t}));z(n),g.current=requestAnimationFrame(y)};s((function(){return o?g.current=requestAnimationFrame(y):(z(Array(40).fill(4)),g.current&&cancelAnimationFrame(g.current)),function(){g.current&&cancelAnimationFrame(g.current)}}),[o,r]);var E=o?"#364152":"#D0D4DB",b="microphone"===a?o||p?n7:t7:o?r7:a7;return e("div",M({className:h,style:{position:"relative",height:"3rem",zIndex:50,width:"100%",overflow:"hidden",display:"flex",alignItems:"center"}},{children:[n("div",M({style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",height:"2rem",gap:"0.25rem"}},{children:f.map((function(e,t){return n("div",{style:{flexShrink:0,width:"4px",borderRadius:"9999px",transition:"all 100ms",backgroundColor:E,height:"".concat(e,"px"),opacity:o?1:.4}},t)}))})),n("button",M({onClick:d,disabled:m,"aria-label":"".concat(a," button"),style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"2rem",height:"2rem",borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 200ms",backgroundColor:"white",border:"1px solid ".concat(E),cursor:m?"not-allowed":"pointer"}},{children:n(b,{color:E,className:p?"animate-spin":"",style:{width:"1.25rem",height:"1.25rem"}})}))]}))};C(".welcome-message{align-items:flex-start;animation:fadeSlideIn 1.2s ease-out forwards;border-radius:.5rem;color:#333;display:fixed;font-size:1rem;line-height:1.75rem;max-width:100%;opacity:0;overflow-wrap:break-word;padding:1rem;transform:translateY(10px);white-space:pre-wrap;word-break:break-word}@keyframes fadeSlideIn{to{opacity:1;transform:translateY(0)}}");var c7,i7,l7=function(){return n("svg",M({width:"20px",height:"20px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M9.91158 12H7.45579H4L2.02268 4.13539C2.0111 4.0893 2.00193 4.04246 2.00046 3.99497C1.97811 3.27397 2.77209 2.77366 3.46029 3.10388L22 12L3.46029 20.8961C2.77983 21.2226 1.99597 20.7372 2.00002 20.0293C2.00038 19.9658 2.01455 19.9032 2.03296 19.8425L3.5 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},s7=function(t){var r=t.resetChatHistory,a=t.isStreamEnd;return e("div",M({className:j8,style:{width:"100%",padding:"0.75rem 0rem",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"#fff",borderBottom:"1px solid #e5e7eb",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.04)"}},{children:[e("span",M({style:{fontSize:"1.25rem",fontWeight:700,color:"#1f2937",flex:1,marginLeft:"0.5rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:[n("span",M({style:{color:"#5928ED"}},{children:"InstantLearning.AI"}))," Chat"]})),n(LJ,M({title:"New chat",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n("div",M({onClick:function(){console.log(B8,"hello"),a&&r()},style:{height:"1.8rem",width:"1.8rem",marginLeft:"1rem",marginRight:"0.5rem",cursor:a?"pointer":"not-allowed",backgroundColor:"transparent",transition:"transform 0.2s ease-in-out, opacity 0.2s",opacity:a?.8:.4,pointerEvents:a?"auto":"none"},onMouseOver:function(e){a&&(e.currentTarget.style.opacity="1")},onMouseOut:function(e){a&&(e.currentTarget.style.opacity="0.8")}},{children:n(B8,{})}))}))]}))},h7=function(t){var r=t.label,a=t.onToggle,o=c(!1),l=o[0],h=o[1],d=i(null);return s((function(){var e=d.current;e&&l&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.1)",e.style.transform="scale(1)",e.style.backgroundColor="#E8F5E9",e.style.color="#2E7D32")}),[l]),e("span",M({ref:d,onClick:function(){var e=!l;h(e),a(r,e)},style:{cursor:"pointer",backgroundColor:l?"#E8F5E9":"#fbfaff",color:l?"#2E7D32":"#000000de",transition:"all 0.2s ease-in-out"},onMouseEnter:function(e){l||(e.currentTarget.style.boxShadow="0 4px 12px rgba(30, 136, 229, 0.3)",e.currentTarget.style.transform="scale(1.02)",e.currentTarget.style.backgroundColor="#f0f7ff",e.currentTarget.style.color="#1E88E5")},onMouseLeave:function(e){l||(e.currentTarget.style.boxShadow="none",e.currentTarget.style.transform="scale(1)",e.currentTarget.style.backgroundColor="#fbfaff",e.currentTarget.style.color="#000000de")}},{children:[n("span",M({style:{fontWeight:"bold",fontSize:"16px",transition:"all 0.3s ease",transform:l?"scale(1.2)":"scale(1)",opacity:l?1:.9,paddingLeft:"0.25rem",paddingRight:"0.25rem"}},{children:l?"✓":"+"})),n("span",{children:r})]}))},d7=function(t){t.chatAssistantLogoUrl;var r=t.chatAssistantName,a=t.organizationName,o=t.baseUrl,l=t.setInstantLearningSuggestions,d=t.formDataState;t.hasUserFilledForm;var u=t.setHasUserFilledForm,m=t.baseWebsocketUrl,p=t.setIsNewChatClicked;t.selectedText,t.ChatIconComponent,t.ggcAssistantName;var v=t.ThinkingBulbIconComponent;t.hasUserWrittenModification;var f=t.setExtractedModification,z=t.setSave,g=t.setExtractedTooltip,y=t.setIsSaveLoading;t.isSaveLoading,t.save,t.instantLearningSuggestions,t.template;var C=r,L=i("".concat(C,"-").concat(a,"-").concat(N8())),k=i("".concat(N8())),w=o,S=i(null),x=i(null),T=c([]),O=T[0],A=T[1],R=c(!1),N=R[0],_=R[1],D=c(""),P=D[0],F=D[1],I=c([]),B=I[0],j=I[1],U=c(!1),W=U[0],$=U[1],q=c(!1);q[0];var G=q[1],Y=c(!0),K=Y[0],X=Y[1],Q=c(!0),J=Q[0],Z=Q[1],ee=c("");ee[0];var te=ee[1],ne=c(""),re=ne[0],ae=ne[1],oe=c(""),ce=oe[0],ie=oe[1],le=c(!1),se=le[0],he=le[1],de=c(!1),ue=de[0],me=de[1],pe=c(!1),ve=pe[0],fe=pe[1],ze=c([]),ge=ze[0],ye=ze[1],Me=h((function(){return""===(null==P?void 0:P.trim())||se}),[P,se]),Ee=i(null),be=c("100%"),He=be[0],Ve=be[1];h((function(){var e,t,n;return!(""===(null===(e=null==d?void 0:d.original)||void 0===e?void 0:e.trim())||(null==d?void 0:d.isTooltipEnabled)&&""===(null===(t=null==d?void 0:d.tooltip)||void 0===t?void 0:t.trim())||(null==d?void 0:d.isModificationEnabled)&&""===(null===(n=null==d?void 0:d.modification)||void 0===n?void 0:n.trim()))}),[d]),s((function(){var e="Please tell me how I should correct “".concat((null==d?void 0:d.original)||"","”? ");ie(e)}),[d]),s((function(){var e=S.current,t=function(){var e=S.current;if(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;fe(!(n-(t+r)<=35))}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}}),[ve,K,B]);var Ce=function(e){return h((function(){for(var t,n=[],r=/['"]conditions_whentoapply['"]\s*:\s*(\[\s*\]|\[\s*\{\s*['"]when_to_apply['"]\s*:\s*(['"])(?:\\.|(?!\2).)*\2\s*,\s*['"]confidence_score['"]\s*:\s*\d+\s*\}(?:\s*,\s*\{\s*['"]when_to_apply['"]\s*:\s*(['"])(?:\\.|(?!\3).)*\3\s*,\s*['"]confidence_score['"]\s*:\s*\d+\s*\})*\s*\])\s*,\s*['"]conditions_whennottoapply['"]\s*:\s*(\[\s*\]|\[\s*\{\s*['"]when_not_to_apply['"]\s*:\s*(['"])(?:\\.|(?!\5).)*\5\s*,\s*['"]confidence_score['"]\s*:\s*\d+\s*\}(?:\s*,\s*\{\s*['"]when_not_to_apply['"]\s*:\s*(['"])(?:\\.|(?!\6).)*\6\s*,\s*['"]confidence_score['"]\s*:\s*\d+\s*\})*\s*\])/,a=0,o=(null===(t=e[e.length-1])||void 0===t?void 0:t.orchestratorAndAgentsMessages)||[];a<o.length;a++){var c=o[a],i=((null==c?void 0:c.responsedata)||"").match(r);if(i)try{var l=q8.parse("{".concat(i[0],"}"));n.push(l)}catch(e){console.error("Failed to parse JSON:",e)}}return n}),[e])}(B);s((function(){var e=(null==Ce?void 0:Ce[(null==Ce?void 0:Ce.length)-1])||null;e&&(l(e),console.log("Parsed suggestions:",Ce))}),[Ce]);var Le=function(e){return h((function(){for(var t,n=[],r=/['"](\w+)['"]\s*:\s*['"](.*?)['"]/g,a=0,o=(null===(t=e[e.length-1])||void 0===t?void 0:t.orchestratorAndAgentsMessages)||[];a<o.length;a++){var c=o[a],i=((null==c?void 0:c.responsedata)||"").match(r);if(i)try{var l=q8.parse("{".concat(i[0],"}"));n.push(l)}catch(e){console.error("Failed to parse JSON for header message:",e)}}return n}),[e])}(B);s((function(){var e=(null==Le?void 0:Le[(null==Le?void 0:Le.length)-1])||null;e&&f(e.modification)}),[Le]);!function(e,t){s((function(){for(var n,r=0,a=(null===(n=e[e.length-1])||void 0===n?void 0:n.orchestratorAndAgentsMessages)||[];r<a.length;r++){for(var o=a[r],c=(null==o?void 0:o.responsedata)||"",i=/<wta>([\s\S]*?)<\/wta>/gi,l=[],s=void 0;null!==(s=i.exec(c));)console.log("match wta suggestion",s),l.push(s[1]);l.length&&t(l)}}),[e,t])}(B,ye);var ke=function(e){return h((function(){for(var t,n=[],r=/^\{\s*(['"])(\w+)\1\s*:\s*(['"])(.*?)\3\s*\}$/,a=0,o=(null===(t=e[e.length-1])||void 0===t?void 0:t.orchestratorAndAgentsMessages)||[];a<o.length;a++){var c=o[a],i=((null==c?void 0:c.responsedata)||"").match(r);if(i){console.log("match: ",i[0]);try{var l=q8.parse(i[0]);n.push(l)}catch(e){console.error("Failed to parse JSON:",e)}}}return n}),[e])}(B);s((function(){var e=(null==ke?void 0:ke[(null==ke?void 0:ke.length)-1])||null;e&&(console.log("latestParseTooltip: ",e),g(null==e?void 0:e.tooltip))}),[ke]);var we=function(e){var t=c([]),n=t[0],r=t[1];return s((function(){for(var t,n=[],a=/\{\s*['"]save['"]\s*:\s*(True|False|true|false)\s*\}/,o=0,c=(null===(t=e[e.length-1])||void 0===t?void 0:t.orchestratorAndAgentsMessages)||[];o<c.length;o++){var i=c[o],l=((null==i?void 0:i.responsedata)||"").match(a);if(l)try{var s=l[0].replace(/\bTrue\b/,"true").replace(/\bFalse\b/,"false").replace(/'/g,'"');console.log("corrected:",s);var h=q8.parse(s);n.push(h)}catch(e){console.error("Failed to parse JSON:",e)}}r(n)}),[e]),n}(B);s((function(){var e=(null==we?void 0:we[(null==we?void 0:we.length)-1])||null;if(e&&"boolean"==typeof e.save){y(!0);var t=setTimeout((function(){y(!1),z(e.save)}),200);return function(){clearTimeout(t)}}}),[we]),s((function(){xe(),Te();var e=function(){var e,t=(null===(e=null==Ee?void 0:Ee.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px");Ve(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]);var Se=function(){var e=S.current;e&&setTimeout((function(){e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),fe(!1)}),100)};s((function(){(null==O?void 0:O.length)>0&&Se()}),[O]);var xe=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(w,"/api/chatbot/getChatSettings?name=").concat(C,"&organizationName=").concat(a),headers:{}};xw.request(e).then((function(e){var t,n,r;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(r=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===r?void 0:r.chatInitialMessage)&&Z(!0)})).catch((function(e){console.error(e)}))},Te=function(){return b(void 0,void 0,void 0,(function(){var e,t;return H(this,(function(n){e="".concat(w,"/api/chat/history?name=").concat(C,"&organizationName=").concat(a);try{t={method:"GET",params:{guestSessionId:L.current},withCredentials:!0},xw.get(e,t).then((function(e){var t=e.data;t.length>0?(j(t),Se()):Z(!0)})).catch((function(e){console.error(e)}))}catch(e){$(!1),console.error(e)}return[2]}))}))};function Oe(e){var t=null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,(function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")}));return t}var Ae=function(e,t,n,r,a,o){var c,i,l,s,h,d,u,m,p,v,f,z,g,y,E,b,H,C;console.log("userInput: ",a);var L={role:"assistant",content:"",id:N8()};if(null===(s=null===(l=null===(i=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===i?void 0:i.message)||void 0===l?void 0:l.content)||void 0===s?void 0:s.includes("WaitMessage: "))$(!1),G(!0),L.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var r=e.substring(n+13);return null==r?void 0:r.replaceAll("WaitMessage: ","")}return""}((null===(u=null===(d=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult)||void 0===d?void 0:d.message)||void 0===u?void 0:u.content)+"\n\n"),j(V(V([],B,!0),[{role:"user",content:a,time:r,isFirstQuestionSent:o||!1,id:(null===(p=null===(m=null==e?void 0:e.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===p?void 0:p.requestId)||"",reply:""},L],!1));else{$(!1),G(!1),L.content=null===(g=Oe(null===(z=null===(f=null===(v=null==e?void 0:e.chatStream)||void 0===v?void 0:v.continueChatResult)||void 0===f?void 0:f.message)||void 0===z?void 0:z.content))||void 0===g?void 0:g.replaceAll("WaitMessage: ","");var k=function(e,t,n){var r,a,o,c,i,l,s,h,d,u,m,p,v,f,z,g,y,E,b,H,C,L,k,w,S,x,T,O,A,R,N,_,D,P,F,I,B,j,U,W,$,q,G,Y,K,X,Q,J,Z,ee,te,ne,re,ae,oe,ce,ie,le,se,he,de,ue,me,pe,ve,fe,ze,ge,ye,Me,Ee,be,He,Ve,Ce,Le,ke,we,Se,xe,Te,Ae,Re,Ne,_e,De,Pe,Fe,Ie,Be,je,Ue,We,$e,qe,Ge,Ye,Ke,Xe,Qe,Je,Ze,et,tt,nt,rt,at,ot,ct,it,lt,st,ht,dt,ut,mt,pt,vt,ft,zt,gt,yt,Mt,Et,bt,Ht,Vt,Ct,Lt,kt,wt,St,xt,Tt,Ot,At,Rt,Nt,_t,Dt,Pt,Ft,It,Bt,jt,Ut,Wt,$t,qt,Gt,Yt,Kt,Xt,Qt,Jt,Zt,en,tn,nn,rn,an,on,cn,ln,sn,hn,dn,un,mn,pn;console.log("event",e,Object.keys(e)),console.log("content: ",null==e?void 0:e.data);var vn={role:"assistant",content:"",id:N8()};if(!1===(null===(o=null===(a=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.chatStream)||void 0===a?void 0:a.continueChatResult)||void 0===o?void 0:o.thinking_break)&&!0===(null===(l=null===(i=null===(c=null==e?void 0:e.data)||void 0===c?void 0:c.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===l?void 0:l.is_orchestrator)&&!1===(null===(d=null===(h=null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.chatStream)||void 0===h?void 0:h.continueChatResult)||void 0===d?void 0:d.isEnd)&&(vn.content=null===(f=Oe(null===(v=null===(p=null===(m=null===(u=null==e?void 0:e.data)||void 0===u?void 0:u.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===p?void 0:p.message)||void 0===v?void 0:v.content))||void 0===f?void 0:f.replaceAll("WaitMessage: ","")),!0===(null===(y=null===(g=null===(z=null==e?void 0:e.data)||void 0===z?void 0:z.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===y?void 0:y.thinking_break)&&!0===(null===(H=null===(b=null===(E=null==e?void 0:e.data)||void 0===E?void 0:E.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===H?void 0:H.is_orchestrator)&&!1===(null===(k=null===(L=null===(C=null==e?void 0:e.data)||void 0===C?void 0:C.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===k?void 0:k.isEnd)&&(vn.content="",t.push({responsedata:null===(T=null===(x=null===(S=null===(w=null==e?void 0:e.data)||void 0===w?void 0:w.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===x?void 0:x.message)||void 0===T?void 0:T.content,responseFrom:null===(R=null===(A=null===(O=null==e?void 0:e.data)||void 0===O?void 0:O.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===R?void 0:R.responded_by,header_message:null===(D=null===(_=null===(N=null==e?void 0:e.data)||void 0===N?void 0:N.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===D?void 0:D.header_message,finalResponseStatus:!1,explainability_id:null!==(B=null===(I=null===(F=null===(P=null==e?void 0:e.data)||void 0===P?void 0:P.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===I?void 0:I.explainability_id)&&void 0!==B?B:"",isParallelToolResponse:!1})),!1===(null===(W=null===(U=null===(j=null==e?void 0:e.data)||void 0===j?void 0:j.chatStream)||void 0===U?void 0:U.continueChatResult)||void 0===W?void 0:W.thinking_break)&&!0===(null===(G=null===(q=null===($=null==e?void 0:e.data)||void 0===$?void 0:$.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===G?void 0:G.is_orchestrator)&&!0===(null===(X=null===(K=null===(Y=null==e?void 0:e.data)||void 0===Y?void 0:Y.chatStream)||void 0===K?void 0:K.continueChatResult)||void 0===X?void 0:X.isEnd)&&(vn.content=null===(te=Oe(null===(ee=null===(Z=null===(J=null===(Q=null==e?void 0:e.data)||void 0===Q?void 0:Q.chatStream)||void 0===J?void 0:J.continueChatResult)||void 0===Z?void 0:Z.message)||void 0===ee?void 0:ee.content))||void 0===te?void 0:te.replaceAll("WaitMessage: ","")),!1===(null===(ae=null===(re=null===(ne=null==e?void 0:e.data)||void 0===ne?void 0:ne.chatStream)||void 0===re?void 0:re.continueChatResult)||void 0===ae?void 0:ae.thinking_break)&&!1===(null===(ie=null===(ce=null===(oe=null==e?void 0:e.data)||void 0===oe?void 0:oe.chatStream)||void 0===ce?void 0:ce.continueChatResult)||void 0===ie?void 0:ie.is_orchestrator)&&!1===(null===(he=null===(se=null===(le=null==e?void 0:e.data)||void 0===le?void 0:le.chatStream)||void 0===se?void 0:se.continueChatResult)||void 0===he?void 0:he.isEnd)){if((gn=null===(ue=null===(de=null==e?void 0:e.data)||void 0===de?void 0:de.chatStream)||void 0===ue?void 0:ue.continueChatResult).explainability_id&&gn.responded_by){var fn=gn.explainability_id,zn=gn.responded_by;n.has(fn)||n.set(fn,{responded_by:zn,index:t.length})}n.has(null===(pe=null===(me=null==e?void 0:e.data)||void 0===me?void 0:me.chatStream)||void 0===pe?void 0:pe.continueChatResult.explainability_id)?t[Hn=null==(yn=n.get(null===(ze=null===(fe=null===(ve=null==e?void 0:e.data)||void 0===ve?void 0:ve.chatStream)||void 0===fe?void 0:fe.continueChatResult)||void 0===ze?void 0:ze.explainability_id))?void 0:yn.index]={responsedata:null===(Ee=null===(Me=null===(ye=null===(ge=null==e?void 0:e.data)||void 0===ge?void 0:ge.chatStream)||void 0===ye?void 0:ye.continueChatResult)||void 0===Me?void 0:Me.message)||void 0===Ee?void 0:Ee.content,responseFrom:null===(Ve=null===(He=null===(be=null==e?void 0:e.data)||void 0===be?void 0:be.chatStream)||void 0===He?void 0:He.continueChatResult)||void 0===Ve?void 0:Ve.responded_by,header_message:null===(ke=null===(Le=null===(Ce=null==e?void 0:e.data)||void 0===Ce?void 0:Ce.chatStream)||void 0===Le?void 0:Le.continueChatResult)||void 0===ke?void 0:ke.header_message,finalResponseStatus:!0,explainability_id:null!==(Te=null===(xe=null===(Se=null===(we=null==e?void 0:e.data)||void 0===we?void 0:we.chatStream)||void 0===Se?void 0:Se.continueChatResult)||void 0===xe?void 0:xe.explainability_id)&&void 0!==Te?Te:"",isParallelToolResponse:!0}:t=V(V([],t,!0),[{responsedata:null===(_e=null===(Ne=null===(Re=null===(Ae=null==e?void 0:e.data)||void 0===Ae?void 0:Ae.chatStream)||void 0===Re?void 0:Re.continueChatResult)||void 0===Ne?void 0:Ne.message)||void 0===_e?void 0:_e.content,responseFrom:null===(Fe=null===(Pe=null===(De=null==e?void 0:e.data)||void 0===De?void 0:De.chatStream)||void 0===Pe?void 0:Pe.continueChatResult)||void 0===Fe?void 0:Fe.responded_by,header_message:null===(je=null===(Be=null===(Ie=null==e?void 0:e.data)||void 0===Ie?void 0:Ie.chatStream)||void 0===Be?void 0:Be.continueChatResult)||void 0===je?void 0:je.header_message,finalResponseStatus:!0,explainability_id:null!==(qe=null===($e=null===(We=null===(Ue=null==e?void 0:e.data)||void 0===Ue?void 0:Ue.chatStream)||void 0===We?void 0:We.continueChatResult)||void 0===$e?void 0:$e.explainability_id)&&void 0!==qe?qe:"",isParallelToolResponse:!1}],!1)}if(!0===(null===(Ke=null===(Ye=null===(Ge=null==e?void 0:e.data)||void 0===Ge?void 0:Ge.chatStream)||void 0===Ye?void 0:Ye.continueChatResult)||void 0===Ke?void 0:Ke.thinking_break)&&!1===(null===(Je=null===(Qe=null===(Xe=null==e?void 0:e.data)||void 0===Xe?void 0:Xe.chatStream)||void 0===Qe?void 0:Qe.continueChatResult)||void 0===Je?void 0:Je.is_orchestrator)&&!1===(null===(tt=null===(et=null===(Ze=null==e?void 0:e.data)||void 0===Ze?void 0:Ze.chatStream)||void 0===et?void 0:et.continueChatResult)||void 0===tt?void 0:tt.isEnd)){var gn,yn;(gn=null===(rt=null===(nt=null==e?void 0:e.data)||void 0===nt?void 0:nt.chatStream)||void 0===rt?void 0:rt.continueChatResult).explainability_id&&gn.responded_by&&(fn=gn.explainability_id,zn=gn.responded_by,n.has(fn)||n.set(fn,{responded_by:zn,index:t.length})),n.has(null===(ct=null===(ot=null===(at=null==e?void 0:e.data)||void 0===at?void 0:at.chatStream)||void 0===ot?void 0:ot.continueChatResult)||void 0===ct?void 0:ct.explainability_id)?t[Hn=null==(yn=n.get(null===(st=null===(lt=null===(it=null==e?void 0:e.data)||void 0===it?void 0:it.chatStream)||void 0===lt?void 0:lt.continueChatResult)||void 0===st?void 0:st.explainability_id))?void 0:yn.index]={responsedata:null===(mt=null===(ut=null===(dt=null===(ht=null==e?void 0:e.data)||void 0===ht?void 0:ht.chatStream)||void 0===dt?void 0:dt.continueChatResult)||void 0===ut?void 0:ut.message)||void 0===mt?void 0:mt.content,responseFrom:null===(ft=null===(vt=null===(pt=null==e?void 0:e.data)||void 0===pt?void 0:pt.chatStream)||void 0===vt?void 0:vt.continueChatResult)||void 0===ft?void 0:ft.responded_by,header_message:null===(yt=null===(gt=null===(zt=null==e?void 0:e.data)||void 0===zt?void 0:zt.chatStream)||void 0===gt?void 0:gt.continueChatResult)||void 0===yt?void 0:yt.header_message,finalResponseStatus:!1,explainability_id:null!==(Ht=null===(bt=null===(Et=null===(Mt=null==e?void 0:e.data)||void 0===Mt?void 0:Mt.chatStream)||void 0===Et?void 0:Et.continueChatResult)||void 0===bt?void 0:bt.explainability_id)&&void 0!==Ht?Ht:"",isParallelToolResponse:!0}:t.push({responsedata:null===(kt=null===(Lt=null===(Ct=null===(Vt=null==e?void 0:e.data)||void 0===Vt?void 0:Vt.chatStream)||void 0===Ct?void 0:Ct.continueChatResult)||void 0===Lt?void 0:Lt.message)||void 0===kt?void 0:kt.content,responseFrom:null===(xt=null===(St=null===(wt=null==e?void 0:e.data)||void 0===wt?void 0:wt.chatStream)||void 0===St?void 0:St.continueChatResult)||void 0===xt?void 0:xt.responded_by,header_message:null===(At=null===(Ot=null===(Tt=null==e?void 0:e.data)||void 0===Tt?void 0:Tt.chatStream)||void 0===Ot?void 0:Ot.continueChatResult)||void 0===At?void 0:At.header_message,finalResponseStatus:!1,explainability_id:null!==(Dt=null===(_t=null===(Nt=null===(Rt=null==e?void 0:e.data)||void 0===Rt?void 0:Rt.chatStream)||void 0===Nt?void 0:Nt.continueChatResult)||void 0===_t?void 0:_t.explainability_id)&&void 0!==Dt?Dt:"",isParallelToolResponse:!1})}var Mn=null===(Bt=null===(It=null===(Ft=null===(Pt=null==e?void 0:e.data)||void 0===Pt?void 0:Pt.chatStream)||void 0===Ft?void 0:Ft.continueChatResult)||void 0===It?void 0:It.message)||void 0===Bt?void 0:Bt.annotations,En=(null===($t=null===(Wt=null===(Ut=null===(jt=null==e?void 0:e.data)||void 0===jt?void 0:jt.chatStream)||void 0===Ut?void 0:Ut.continueChatResult)||void 0===Wt?void 0:Wt.message)||void 0===$t?void 0:$t.userFeedbackId)||"",bn={role:"assistant",content:vn.content,orchestratorAndAgentsMessages:t,time:new Date,requestId:null!==(Kt=null===(Yt=null===(Gt=null===(qt=null==e?void 0:e.data)||void 0===qt?void 0:qt.chatStream)||void 0===Gt?void 0:Gt.continueChatResult)||void 0===Yt?void 0:Yt.requestId)&&void 0!==Kt?Kt:"",citations:null===(Zt=null===(Jt=null===(Qt=null===(Xt=null==e?void 0:e.data)||void 0===Xt?void 0:Xt.chatStream)||void 0===Qt?void 0:Qt.continueChatResult)||void 0===Jt?void 0:Jt.message)||void 0===Zt?void 0:Zt.citations,guides_utilized:null!==(an=null===(rn=null===(nn=null===(tn=null===(en=null==e?void 0:e.data)||void 0===en?void 0:en.chatStream)||void 0===tn?void 0:tn.continueChatResult)||void 0===nn?void 0:nn.message)||void 0===rn?void 0:rn.guides_utilized)&&void 0!==an?an:[],annotations:Mn,resourceId:null===(ln=null===(cn=null===(on=null==e?void 0:e.data)||void 0===on?void 0:on.chatStream)||void 0===cn?void 0:cn.continueChatResult)||void 0===ln?void 0:ln.resourceId,userFeedbackId:En,citationDisplayType:null!==(mn=null===(un=null===(dn=null===(hn=null===(sn=null==e?void 0:e.data)||void 0===sn?void 0:sn.chatStream)||void 0===hn?void 0:hn.continueChatResult)||void 0===dn?void 0:dn.message)||void 0===un?void 0:un.citationDisplayType)&&void 0!==mn?mn:""};if(Mn)for(var Hn=0;Hn<(null==Mn?void 0:Mn.length);Hn++){var Vn=Mn[Hn];bn=M(M({},bn),{content:null===(pn=null==bn?void 0:bn.content)||void 0===pn?void 0:pn.replace(null==Vn?void 0:Vn.text,(null==Vn?void 0:Vn.text)+"<sup>".concat(Hn,"</sup>"))})}return bn}({data:e},n,t);console.log("assistantObject",k),j(V(V([],B,!0),[{role:"user",content:a||"",time:r,isFirstQuestionSent:o||!1,requestId:null!==(b=null===(E=null===(y=null==e?void 0:e.chatStream)||void 0===y?void 0:y.continueChatResult)||void 0===E?void 0:E.requestId)&&void 0!==b?b:""},k],!1)),X(null===(C=null===(H=null==e?void 0:e.chatStream)||void 0===H?void 0:H.continueChatResult)||void 0===C?void 0:C.isEnd)}},Re=function(e,t,n){var r,o=(null==n?void 0:n.trim())||(null==P?void 0:P.trim())||"";if(!("Enter"!==e.key||e.shiftKey||""===(null==n?void 0:n.trim())&&""===(null==P?void 0:P.trim())||se)){he(!0);var c=new Date;j(V(V([],B.map((function(e,t){var n;return M(M({},e),{content:null===(n=Oe(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})})),!0),[{role:"user",content:o,time:c,isFirstQuestionSent:!1}],!1));var i=new Map,l=[];_(!1);var s={WEBSOCKET_URL:m,organizationName:a,chatAssistantName:C,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:(null==n?void 0:n.trim())||(null==P?void 0:P.trim())||"",requestId:"requestId-".concat(N8()),customPrompt:"",enableForBackend:!1,guestSessionId:L.current,chatPreviewId:k.current,customMetaData:M(M({},d),{isFirstQuestion:0===B.length}),aiModel:"",onStreamEvent:function(e){return Ae(e,i,l,c,o,t)},onStreamEnd:function(e){he(!1)},onError:function(e){return console.error("Stream error:",e)}};if(""!==(null==P?void 0:P.trim())||(null==n?void 0:n.trim())){$(!0),null===(r=x.current)||void 0===r||r.blur(),F(""),Se();for(var h="Thanks for sharing your thoughts. I’m putting together the most helpful suggestions now, so we can make sure this really fits your needs.".split(" "),u="",p=function(e){setTimeout((function(){u+=h[e]+" ",ae(u.trim())}),25*e)},v=0;v<h.length;v++)p(v);x8.startChatStream(s)}}},Ne=h((function(){return{img:function(e){e.node;var t=E(e,["node"]);return n("img",M({},t,{style:{height:"100%",width:"100%",objectFit:"contain"},alt:(null==t?void 0:t.alt)||"",className:"w-full sm:max-w-lg md:max-w-2xl lg:max-w-4xl mx-auto"}))},p:function(e){e.node;var t=E(e,["node"]);return n("p",M({},t,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"block",fontSize:"1rem",lineHeight:"1.625rem",marginBottom:"1rem",marginTop:"10px"}},{children:null==t?void 0:t.children}))},code:function(e){e.node;var t=E(e,["node"]);return n("span",M({},t,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"inline-flex",fontSize:"1rem",lineHeight:"1.625rem"}},{children:null==t?void 0:t.children}))},ol:function(e){e.node;var t=E(e,["node"]);return n("ol",M({},t,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==t?void 0:t.children}))},ul:function(e){e.node;var t=E(e,["node"]);return n("ul",M({},t,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==t?void 0:t.children}))},wta:function(e){e.node;var t=E(e,["node"]);t.key||t["data-key"];var r=t.label||t.children||"Unknown label";return n(h7,{label:r,onToggle:function(e,t){!function(e,t){var n=Array.isArray(e)?e[0]:e;null==O||O.length,_(!0),A((function(e){return t?e.includes(n)?e:V(V([],e,!0),[n],!1):e.filter((function(e){return e!==n}))}))}(e,t)}})}}}),[]),_e=h((function(){if(!Array.isArray(O)||!Array.isArray(ge))return"";var e=O.map((function(e){return ge.indexOf(e)})).filter((function(e){return-1!==e})).map((function(e){return e+1}));return e.join(" and ")}),[O,ge]);return e("div",M({className:j8,style:{height:"100%",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontFamily:"Plus Jakarta Sans, sans-serif",backgroundColor:"#fbfaff",border:"1px solid #d1d5db",overflow:"hidden"}},{children:[e("div",M({style:{width:"100%",height:"100%",backgroundColor:"#fbfaff",maxWidth:"100%",overflow:"hidden"}},{children:[n("div",M({ref:Ee},{children:n(s7,{resetChatHistory:function(){var e="".concat(w,"/api/chat/resetHistory?name=").concat(C,"&organizationName=").concat(a);try{var t={method:"GET",params:{guestSessionId:L.current},withCredentials:!0};xw.get(e,t).then((function(){f(""),g(""),p(!0),_(!1),A([]),te(""),k.current="".concat(N8()),u(!1),j([]),Z(!0)})).catch((function(e){console.error(e)}))}catch(e){$(!1),console.error(e)}},isStreamEnd:K})})),e("div",M({style:{width:"100%",height:He,maxHeight:He,overflowY:"auto",backgroundColor:"#fbfaff"},ref:S},{children:[n("div",M({className:"welcome-message",style:{alignItems:"flex-start",paddingLeft:"0.5rem",paddingTop:"1rem",maxWidth:"70%",fontSize:"1rem",lineHeight:"1.75rem",borderRadius:"0.5rem",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"#333",fontWeight:"700",textAlign:"left"}},{children:n("span",{children:"I’m here to help fine-tune your learning so it works as accurately as it should."})})),B.length?B.map((function(t,r){return e("div",M({style:{display:"flex",padding:"0.5rem 1rem",maxWidth:"100%"}},{children:["assistant"==(null==t?void 0:t.role)&&n("div",M({style:{maxHeight:"32px",maxWidth:"32px",marginTop:"0.5rem",marginRight:"1rem"}},{children:e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]}))})),e("div",M({style:{width:"100%"}},{children:["assistant"===t.role&&t.orchestratorAndAgentsMessages&&t.orchestratorAndAgentsMessages.length>0&&n(I8,{orchestratorAndAgentsMessages:null==t?void 0:t.orchestratorAndAgentsMessages,isStreamEnd:K,isCurrentMessage:r===B.length-1,ThinkingBulbIconComponent:v}),"assistant"===(null==t?void 0:t.role)?n(vM,M({components:Ne,rehypePlugins:[sC]},{children:t.content}),r):n("span",{}),n("div",M({style:{display:"flex",justifyContent:"flex-end"}},{children:"user"===t.role?n("div",M({style:{backgroundColor:"#8694A10D",padding:"0 1rem",borderRadius:"8px",maxWidth:"80%"}},{children:n(vM,M({components:Ne,rehypePlugins:[sC]},{children:t.content}),r)})):n("span",{})}))]}))]}))})):J&&e("div",M({style:{display:"flex",flexDirection:"row",fontFamily:"inherit",padding:"16px 10px 0px 16px",maxWidth:"80%"}},{children:[n("div",M({style:{maxHeight:"32px",maxWidth:"32px",marginTop:"0.3rem"}},{children:e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]}))})),n("div",M({style:{display:"flex",flexDirection:"column",fontWeight:400,color:"#000"}},{children:n("div",M({style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:"1rem",paddingRight:"1rem",width:"100%",maxWidth:"100%",fontSize:"1rem",lineHeight:"1.75rem",marginBottom:"1rem",borderRadius:"0.5rem",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"#333"}},{children:n("span",{children:n(vM,M({components:{p:function(e){e.node;var t=E(e,["node"]);return n("p",M({},t,{style:{margin:0}},{children:null==t?void 0:t.children}))}}},{children:ce}))})}))}))]})),n("div",M({style:{display:"flex",padding:"0.5rem 1rem",maxWidth:"100%"}},{children:n("div",M({style:{width:"100%",marginLeft:"2.75rem"}},{children:(null==O?void 0:O.length)>0&&N?e("span",{children:["It looks like you’ve chosen ",O.length>1?"suggestions":"suggestion"," ",_e,". Would you like me to proceed with them?",n("p",{children:n("button",M({style:{padding:"0.5rem 1rem",margin:"1rem 0rem",backgroundColor:"#4CAF50",color:"white",border:"none",borderRadius:"8px",cursor:"pointer",fontSize:"0.75rem",fontWeight:"500",boxShadow:"0 2px 5px rgba(0, 0, 0, 0.2)",transition:"background-color 0.3s",fontFamily:"Plus Jakarta Sans, sans-serif"},onClick:function(e){Re(new KeyboardEvent("keydown",{key:"Enter"}),!1,"I want the when to apply conditions to be ".concat(O.join(" or ")))}},{children:"Yes"}))})]}):n("span",{})}))})),W&&e("div",M({style:{display:"flex",padding:"16px 16px 0px 16px"}},{children:[n("div",M({style:{maxHeight:"32px",maxWidth:"32px",marginTop:"0.2rem"}},{children:e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]}))})),n("div",M({style:{display:"inline-flex",alignItems:"flex-start",paddingLeft:"1rem",paddingRight:"1rem",paddingBottom:"1rem",width:"100%",maxWidth:"100%",fontSize:"1rem",lineHeight:"1.75rem",marginBottom:"1rem",borderRadius:"0.5rem",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"#333"}},{children:n("span",{children:re})}))]}))]}))]})),e("div",M({style:{width:"95%",height:"content-fit",backgroundColor:"#fbfaff",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"end",position:"relative"}},{children:[n("div",M({style:{visibility:ve?"visible":"hidden",position:"absolute",top:"-3rem",zIndex:0,pointerEvents:"none"}},{children:n("button",M({onClick:Se,style:{borderRadius:"9999px",padding:0,backgroundColor:"#fff",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",border:"1px solid #d1d5db",pointerEvents:"auto",cursor:"pointer",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1,height:"2.25rem",width:"2.25rem",margin:"0.3rem"}},{children:n("svg",M({fill:"#000000",width:"16px",height:"16px",viewBox:"0 0 24 24",id:"down","data-name":"Flat Color",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{id:"primary",d:"M19.71,13.29a1,1,0,0,0-1.42,0L13,18.59V3a1,1,0,0,0-2,0V18.59l-5.29-5.3a1,1,0,0,0-1.42,1.42l7,7a1,1,0,0,0,1.42,0l7-7A1,1,0,0,0,19.71,13.29Z"})}))}))})),n("div",M({style:{width:"100%",backgroundColor:"#fff",display:"flex",alignItems:"end",gap:"0.5rem",border:"1px solid #E5E7EB",borderRadius:"8px"}},{children:e("div",M({style:{width:"100%",display:"flex"}},{children:[n("textarea",{ref:x,placeholder:"Tell me more about this learning...",value:P||"",onChange:function(e){return F(e.target.value)},onFocus:function(){return me(!0)},onBlur:function(){return me(!1)},onKeyDown:function(e){return Re(e)},style:{flexGrow:1,padding:"0.5rem",borderRadius:"0.5rem",border:"none",fontSize:"1rem",lineHeight:"1.5rem",resize:"none",backgroundColor:"#fff",color:"inherit",minHeight:ue?"120px":"50px",height:ue?"120px":"50px",maxHeight:"120px",overflowY:"auto",fontFamily:"inherit",outline:"none",transition:"min-height 0.3s ease, background-color 0.3s ease",boxSizing:"border-box"}}),e("span",M({style:{display:"flex",flexDirection:"column",justifyContent:"end",alignItems:"end"}},{children:[" ",n("button",M({onClick:function(e){Re(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Me,style:{padding:"0.5rem 0.75rem",borderRadius:"0.375rem",border:"none",backgroundColor:"white",color:Me?"#d1d5db":"#5928ed",fontWeight:"bold",fontSize:"1rem",cursor:Me?"not-allowed":"pointer",transition:"background-color 0.3s, color 0.3s",height:"50px"}},{children:n(l7,{})}))]}))]}))}))]})),e("div",M({style:{width:"95%",display:"flex",gap:"0.25rem",flexDirection:"row"}},{children:[n(LJ,M({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n("span",M({style:{width:"50%"}},{children:n(o7,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),n(LJ,M({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n("span",M({style:{width:"50%"}},{children:n(o7,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))},u7={},m7={exports:{}},p7={exports:{}};function v7(){return c7||(c7=1,function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(p7)),p7.exports}function f7(){return i7||(i7=1,function(e){var t=v7().default;function n(r,a){if("function"==typeof WeakMap)var o=new WeakMap,c=new WeakMap;return(e.exports=n=function(e,n){if(!n&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=t(e)&&"function"!=typeof e)return i;if(r=n?c:o){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i},e.exports.__esModule=!0,e.exports.default=e.exports)(r,a)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(m7)),m7.exports}var z7,g7,y7={},M7=Te(rl);function E7(){return z7||(z7=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=M7}(y7)),y7}var b7,H7=function(){if(g7)return u7;g7=1;var e=p_(),t=f7();Object.defineProperty(u7,"__esModule",{value:!0}),u7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");return u7.default=r,u7}(),V7=xe(H7),C7={};var L7,k7=function(){if(b7)return C7;b7=1;var e=p_(),t=f7();Object.defineProperty(C7,"__esModule",{value:!0}),C7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"}),"Lock");return C7.default=r,C7}(),w7=xe(k7),S7={};var x7=function(){if(L7)return S7;L7=1;var e=p_(),t=f7();Object.defineProperty(S7,"__esModule",{value:!0}),S7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 00-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),"Edit");return S7.default=r,S7}(),T7=xe(x7),O7=function(t){var r=t.selectedText,a=t.scopeOptions,o=t.devModeTag,d=t.chatLogo,u=void 0===d?null:d,m=t.submitFunction;t.setShowChat,t.showChat;var p=t.setFormDataState,v=t.instantLearningSuggestions;t.setHasUserFilledForm,t.hasUserFilledForm;var f=t.isNewChatClicked,z=t.setIsNewChatClicked,g=t.setHasUserWrittenModification,y=t.extractedModification,E=t.save,b=t.extractedTooltip;t.isSaveLoading;var H=c({context:"",issue_with_response:"",original:null!=r?r:"",modification:"",whenToApply:"",whenNotToApply:"",tooltip:"",scope:a[0].value,isTooltipEnabled:!1,isModificationEnabled:!0,isDevMode:!1}),C=H[0],L=H[1],k=c(!1),w=k[0],S=k[1],x=c(!1),T=x[0],O=x[1],A=c(!1),R=A[0],N=A[1],_=c(!1),D=_[0],P=_[1],F=c([]),I=F[0],B=F[1],j=c([]),U=j[0],W=j[1],$=c(!1),q=$[0],G=$[1],Y=c(!1),K=Y[0],X=Y[1],Q=c(!1),J=Q[0],Z=Q[1],ee=h((function(){var e,t,n,r,a=""!==(null===(e=null==C?void 0:C.original)||void 0===e?void 0:e.trim()),o=""!==(null===(t=null==C?void 0:C.whenToApply)||void 0===t?void 0:t.trim()),c=(null==I?void 0:I.length)>0,i=!(null==C?void 0:C.isTooltipEnabled)||""!==(null===(n=null==C?void 0:C.tooltip)||void 0===n?void 0:n.trim()),l=!0;return(null==C?void 0:C.isModificationEnabled)&&(l=""!==(null===(r=null==C?void 0:C.modification)||void 0===r?void 0:r.trim())),a&&o&&c&&(i||l)}),[C,I,v]),te=i(null);s((function(){if(""===y&&(null==C?void 0:C.isTooltipEnabled)&&L((function(e){return M(M({},e),{isModificationEnabled:!1})})),""!==y||(null==C?void 0:C.isTooltipEnabled)||L((function(e){return M(M({},e),{modification:""})})),y&&""!==y){L((function(e){return M(M({},e),{modification:y,isModificationEnabled:!0})})),P(!0);var e=setTimeout((function(){P(!1)}),400);return function(){return clearTimeout(e)}}}),[y]),s((function(){""===b&&L((function(e){return M(M({},e),{isTooltipEnabled:!1})})),b&&""!==b&&L((function(e){return M(M({},e),{tooltip:b,isTooltipEnabled:!0})}))}),[b]),s((function(){f&&(L((function(e){return M(M({},e),{modification:"",tooltip:"",isTooltipEnabled:!1,isModificationEnabled:!0})})),B([]),W([]),z(!1))}),[f]),s((function(){p(C)}),[C]),s((function(){""===C.original.trim()||""===C.modification.trim()&&""===C.tooltip.trim()||w||S(!0)}),[C]),s((function(){if((null==I?void 0:I.length)>0&&!q){O(!0);var e=setTimeout((function(){O(!1)}),400);return function(){return clearTimeout(e)}}}),[JSON.stringify(I)]),s((function(){if((null==U?void 0:U.length)>0&&!K){N(!0);var e=setTimeout((function(){N(!1)}),400);return function(){return clearTimeout(e)}}}),[JSON.stringify(U)]),s((function(){var e,t,n,r;if(v){G(!1),X(!1);var a=null===(e=null==v?void 0:v.conditions_whentoapply)||void 0===e?void 0:e.map((function(e){return e.when_to_apply})),o=null===(t=null==v?void 0:v.conditions_whennottoapply)||void 0===t?void 0:t.map((function(e){return e.when_not_to_apply}));(null===(n=null==v?void 0:v.conditions_whentoapply)||void 0===n?void 0:n.length)&&(B(a),L((function(e){return M(M({},e),{whenToApply:null==a?void 0:a.join(" OR ")})}))),(null===(r=null==v?void 0:v.conditions_whennottoapply)||void 0===r?void 0:r.length)&&(W(o),L((function(e){return M(M({},e),{whenNotToApply:null==o?void 0:o.join(" OR ")})})))}}),[v]);var ne,re=i(null),ae=l((function(){re.current&&clearTimeout(re.current),re.current=setTimeout((function(){g(!0)}),1e3)}),[]),oe=l((function(e){return function(t){L((function(n){var r;return M(M({},n),((r={})[e]=t.target.value,r))})),ae()}}),[ae]),ce=function(e){return e.replace(new RegExp("<".concat(o,">"),"gi"),"").replace(new RegExp("</".concat(o,">"),"gi"),"").replace(/<\/?[^>]+(>|$)/g,"")},ie=l((function(e){var t=ce(e);L((function(e){return M(M({},e),{tooltip:t})})),ae()}),[ae]),le=function(e){return function(t){var n=t.target.checked,r={};"isTooltipEnabled"===e?r={tooltip:n?C.tooltip:"",isModificationEnabled:!n||C.isModificationEnabled}:"isModificationEnabled"===e&&(r={modification:n?C.modification:""}),L((function(t){var a;return M(M(M({},t),r),((a={})[e]=n,a))}))}},se=function(){console.log("Form submitted:",C),Z(!0),""===(null==C?void 0:C.modification)&&L((function(e){return M(M({},e),{isModificationEnabled:!1})})),""===(null==C?void 0:C.tooltip)&&L((function(e){return M(M({},e),{isTooltipEnabled:!1})})),m(C,Z)};return s((function(){E&&se()}),[E]),e(Yj,M({p:0,className:j8,sx:{display:"flex",flexDirection:"column",height:"100%",width:"100%"}},{children:[n(Yj,{children:n(iF,M({sx:{fontSize:20,fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:"Instant Learning"}))}),e(Yj,M({sx:{fontFamily:"Plus Jakarta Sans",display:"flex",flexDirection:"column",gap:2,justifyContent:"space-between",flexGrow:1,paddingTop:"20px",height:"calc(100% - 30px)",overflow:"hidden"}},{children:[e(Yj,M({sx:{display:"flex",flexDirection:"column",gap:"20px",height:"calc(100% - 90px)",overflow:"hidden"}},{children:[e(Yj,M({sx:{display:"flex",gap:2}},{children:[e(Yj,M({sx:{flex:1}},{children:[e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[e(iF,M({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center"}},{children:["Original"," ",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Original word/phrase which needs to be replaced",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),n(YZ,{sx:{visibility:"hidden"},disabled:!0})]})),n(j2,{sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}},id:"original",value:C.original,onChange:oe("original"),fullWidth:!0,placeholder:"Enter original"})]})),e(Yj,M({sx:{flex:1}},{children:[e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[e(iF,M({sx:{fontFamily:"Plus Jakarta Sans",fontWeight:600,fontSize:"1rem",display:"flex",alignItems:"center"}},{children:["Modification",C.isModificationEnabled&&!C.isTooltipEnabled&&n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Modified word/phrase which Original needs to be replaced with",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),n(YZ,{checked:C.isModificationEnabled,disabled:!C.isTooltipEnabled,onChange:le("isModificationEnabled"),sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#5928ed"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:"#5928ed"}}})]})),C.isModificationEnabled&&n(j2,{sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},boxShadow:D?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out"},id:"modification",value:C.modification,onChange:oe("modification"),fullWidth:!0,placeholder:"Change ".concat(r," to...")})]}))]})),e(Yj,M({sx:{display:"flex",gap:2}},{children:[n(Yj,{sx:{flex:1}}),e(Yj,M({sx:{flex:1}},{children:[e(Yj,M({sx:{display:"flex",justifyContent:"space-between"}},{children:[e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"}},{children:["Tooltip",C.isTooltipEnabled&&n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Adds a tooltip to the modification or the original word",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),n(YZ,{checked:C.isTooltipEnabled,onChange:le("isTooltipEnabled"),sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#5928ed"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:"#5928ed"}}})]})),C.isTooltipEnabled&&e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[n(iF,M({sx:{fontSize:14,fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:"Dev Mode"})),n(YZ,{checked:C.isDevMode,onChange:le("isDevMode"),sx:{"& .MuiSwitch-switchBase.Mui-checked":{color:"#4b5563"},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:"#4b5563"}}})]}))]})),C.isTooltipEnabled&&n(j2,{id:"tooltip",inputRef:te,value:function(){var e=ce(C.tooltip);return C.isDevMode?"<".concat(o,">").concat(e,"</").concat(o,">"):e}(),onChange:function(e){return ie(e.target.value)},onFocus:function(){setTimeout((function(){if(C.isDevMode){var e=ce(C.tooltip),t="<".concat(o,">").length+e.length,n=te.current;n&&n.setSelectionRange(t,t)}}),0)},fullWidth:!0,placeholder:C.isDevMode?"<".concat(o,">Enter tooltip content</").concat(o,">"):"Enter tooltip content",sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}}})]}))]})),e(Yj,M({sx:{display:"flex",gap:2,height:"".concat(C.isTooltipEnabled?"calc(100% - 248px)":"calc(100% - 200px)")}},{children:[!(null==I?void 0:I.length)&&e(Yj,M({sx:{flex:1}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When To Apply",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Specific situations or conditions where this learning should be applied.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 64px)",display:"flex",flexDirection:"column"}},{children:[e("div",M({style:{width:"100%",display:"flex",gap:"0.25rem"}},{children:[e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),n("div",M({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:e("div",M({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[n("div",M({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),e("div",M({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[n("div",M({style:{}},{children:"Tell us about your learning in "})),n("span",M({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",n("span",{children:"Chat"})]}))]}))}))]}))]})),(null==I?void 0:I.length)>0&&e(Yj,M({sx:{flex:1,height:"100%"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans, sans-serif",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When To Apply",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Specific situations or conditions where this learning should be applied.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 64px)",boxShadow:T?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",marginLeft:"4px"}},{children:[e(Yj,M({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:[e(Yj,M({display:"flex",gap:"0.25rem",alignItems:"center"},{children:[u&&n(Yj,{component:"img",src:u,alt:"Chat",sx:{width:14,height:14}}),e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),(null==I?void 0:I.length)>0&&n(LJ,M({title:q?"Save & Lock":"Edit",componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(UP,M({disabled:I.some((function(e){return""===(null==e?void 0:e.trim())})),onClick:function(){return G((function(e){return!e}))},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:n(q?w7:T7,{fontSize:"small"})}))}))]})),n(Yj,M({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:n("ol",M({style:{paddingLeft:"0rem",fontFamily:"Plus Jakarta Sans",margin:0}},{children:T?e(Yj,M({sx:{display:"flex",justifyContent:"center",py:2,gap:2}},{children:[n(xW,{size:24}),n("span",{children:"Generating When to apply..."})]})):n(Yj,M({sx:{pt:"16px"}},{children:I.map((function(t,r){return e(Yj,M({sx:{display:"flex",alignItems:"flex-start",gap:1,mb:r<I.length-1?2:0,fontFamily:"Plus Jakarta Sans"},component:"li"},{children:[n(j2,{variant:"outlined",disabled:!q,fullWidth:!0,multiline:!0,value:"".concat(t),error:!t.trim(),onChange:function(e){var t=V([],I,!0);t[r]=e.target.value,B(t),L((function(e){return M(M({},e),{whenToApply:t.join(" OR ")})}))},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}},InputProps:{startAdornment:e(VG,M({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[r+1,"."]}))}}),q&&n(UP,M({onClick:function(){if(I.length>1){var e=I.filter((function(e,t){return t!==r}));B(e),L((function(t){return M(M({},t),{whenToApply:e.join(" OR ")})}))}},sx:{mt:1}},{children:n(V7,{})}))]}),r)}))}))}))}))]}))]})),!(null==U?void 0:U.length)&&e(Yj,M({sx:{flex:1}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When Not To Apply",n(LJ,M({title:"Cases where this learning should not be applied to avoid incorrect responses.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,flex:1,display:"flex",flexDirection:"column",height:"calc(100% - 64px)"}},{children:[e("div",M({style:{width:"100%",display:"flex",gap:"0.25rem"}},{children:[e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),n("div",M({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:e("div",M({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[n("div",M({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),e("div",M({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[n("div",M({style:{}},{children:"Tell us about your learning in "})),n("span",M({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",n("span",{children:"Chat"})]}))]}))}))]}))]})),(null==U?void 0:U.length)>0&&e(Yj,M({sx:{flex:1,height:"100%"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When Not To Apply",n(LJ,M({title:"Cases where this learning should not be applied to avoid incorrect responses.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 64px)",boxShadow:R?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",marginRight:"4px"}},{children:[e(Yj,M({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:[e(Yj,M({display:"flex",gap:"0.25rem",alignItems:"center"},{children:[u&&n(Yj,{component:"img",src:u,alt:"Chat",sx:{width:14,height:14}}),e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),(null==U?void 0:U.length)>0&&n(LJ,M({placement:"top",arrow:!0,title:K?"Save & Lock":"Edit",componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(UP,M({disabled:U.some((function(e){return""===(null==e?void 0:e.trim())})),onClick:function(){return X((function(e){return!e}))},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:n(K?w7:T7,{fontSize:"small"})}))}))]})),n(Yj,M({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:n("ol",M({style:{paddingLeft:"0rem",margin:0}},{children:R?e(Yj,M({sx:{display:"flex",justifyContent:"center",py:2,gap:2}},{children:[n(xW,{size:24}),n("span",{children:"Generating When not to apply..."})]})):n(Yj,M({sx:{pt:"16px"}},{children:U.map((function(t,r){return e(Yj,M({sx:{display:"flex",alignItems:"flex-start",gap:1,mb:r<U.length-1?2:0},component:"li"},{children:[n(j2,{variant:"outlined",disabled:!K,fullWidth:!0,multiline:!0,value:"".concat(t),error:!t.trim(),onChange:function(e){var t=V([],U,!0);t[r]=e.target.value,W(t),L((function(e){return M(M({},e),{whenNotToApply:t.join(" OR ")})}))},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}},InputProps:{startAdornment:e(VG,M({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[r+1,"."]}))}}),K&&n(UP,M({onClick:function(){if(U.length>1){var e=U.filter((function(e,t){return t!==r}));W(e),L((function(t){return M(M({},t),{whenNotToApply:e.join(" OR ")})}))}},disabled:1===U.length,sx:{mt:1}},{children:n(V7,{})}))]}),r)}))}))}))}))]}))]}))]}))]})),e(Yj,M({sx:{display:"flex",gap:2}},{children:[e(Yj,M({sx:{flex:1}},{children:[n(iF,M({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"},gutterBottom:!0},{children:"Scope"})),n(tq,M({sx:{width:"50%",fontFamily:"Plus Jakarta Sans"},variant:"outlined"},{children:e(iQ,M({id:"scope",value:C.scope,onChange:(ne="scope",function(e){L((function(t){var n;return M(M({},t),((n={})[ne]=e.target.value,n))}))}),displayEmpty:!0,sx:{fontFamily:"Plus Jakarta Sans"},fullWidth:!0},{children:[n(dK,M({value:"",disabled:!0},{children:"Select scope"})),a.map((function(e,t){return n(dK,M({value:e.value,sx:{fontFamily:"Plus Jakarta Sans"}},{children:e.labelText}),t)}))]}))}))]})),n(Yj,M({sx:{flex:1,display:"flex",alignItems:"flex-end",justifyContent:"flex-end"}},{children:e(zU,M({variant:"contained",onClick:se,sx:{width:"30%",height:"56px",fontFamily:"Plus Jakarta Sans",backgroundColor:"green",textTransform:"capitalize","&:hover":{backgroundColor:"#006400"}},disabled:!ee},{children:[J&&n(xW,{sx:{marginRight:"8px",color:"#fff"},size:16}),J?"Saving":"Save"]}))}))]}))]}))]}))},A7=function(t){var r=t.options,a=t.label,o=void 0===a?"Select Template for Stormee":a,i=t.required,l=void 0===i||i,s=t.onChange,h=t.setSelectedTemplate,d=c(""),u=d[0],m=d[1];return e(tq,M({size:"small",style:{minWidth:200,backgroundColor:"#fff",borderRadius:12}},{children:[e(iF,M({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"0.95rem",fontWeight:600,marginBottom:"6px",color:"#1a1a1a",display:"flex",alignItems:"center"}},{children:[o,l&&n(Yj,M({component:"span",sx:{color:"red",marginLeft:"4px"}},{children:"*"}))]})),e(iQ,M({value:u,displayEmpty:!0,onChange:function(e){var t=e.target.value;m(t),null==s||s(t),h(t)},style:{borderRadius:10,fontWeight:500,fontSize:15,fontFamily:"Plus Jakarta Sans",color:u?"#5928ed":"#888",padding:"10px 14px"},MenuProps:{PaperProps:{style:{borderRadius:10,boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.08)",maxHeight:250}}},sx:{"& .MuiOutlinedInput-notchedOutline":{border:"1px solid #ddd"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#bbb"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#5928ed"}}},{children:[n(dK,M({sx:{fontFamily:"Plus Jakarta Sans"},value:"",disabled:!0},{children:"Choose an option"})),r.map((function(e){return n(dK,M({value:e.value,sx:{fontFamily:"Plus Jakarta Sans",fontWeight:500,fontSize:14,color:"#333","&:hover":{backgroundColor:"#f2f0fe"},"&.Mui-selected":{backgroundColor:"#5928ed !important",color:"#fff"},"&.Mui-selected:hover":{backgroundColor:"#4e23d1 !important"}}},{children:e.label}),e.value)}))]}))]}))},R7=function(t){var r=t.selectedText,a=t.scopeOptions,o=t.devModeTag,d=t.chatLogo,u=void 0===d?null:d,m=t.submitFunction;t.setShowChat,t.showChat;var p=t.setFormDataState,v=t.instantLearningSuggestions;t.setHasUserFilledForm,t.hasUserFilledForm;var f=t.isNewChatClicked,z=t.setIsNewChatClicked,g=t.setHasUserWrittenModification,y=t.extractedModification,E=t.save,b=t.extractedTooltip;t.isSaveLoading,t.template;var H=t.userQuery,C=t.templateOptions,L=t.topic,k=c({context:"",issue_with_response:"",original:null!=r?r:"",modification:"",whenToApply:"",whenNotToApply:"",tooltip:"",scope:a[0].value,isTooltipEnabled:!1,isModificationEnabled:!0,isDevMode:!1,userQuery:H||"",howToRespond:"",topic:L}),w=k[0],S=k[1],x=c(!1),T=x[0],O=x[1],A=c(!1),R=A[0],N=A[1],_=c(!1),D=_[0],P=_[1],F=c(!1);F[0];var I=F[1],B=c(""),j=B[0],U=B[1],W=c("");W[0],W[1];var $=c([]),q=$[0],G=$[1],Y=c([]),K=Y[0],X=Y[1],Q=c(!1),J=Q[0],Z=Q[1],ee=c(!1),te=ee[0],ne=ee[1],re=c(!1),ae=re[0],oe=re[1],ce=h((function(){var e,t;return""!==(null===(e=null==w?void 0:w.userQuery)||void 0===e?void 0:e.trim())&&""!==(null===(t=null==w?void 0:w.howToRespond)||void 0===t?void 0:t.trim())}),[w,q,v]);i(null),s((function(){S((function(e){return M(M({},e),{howToRespond:"".concat(j)})}))}),[j]),s((function(){if(""===y&&(null==w?void 0:w.isTooltipEnabled)&&S((function(e){return M(M({},e),{isModificationEnabled:!1})})),""!==y||(null==w?void 0:w.isTooltipEnabled)||S((function(e){return M(M({},e),{modification:""})})),y&&""!==y){S((function(e){return M(M({},e),{modification:y,isModificationEnabled:!0})})),I(!0);var e=setTimeout((function(){I(!1)}),400);return function(){return clearTimeout(e)}}}),[y]),s((function(){""===b&&S((function(e){return M(M({},e),{isTooltipEnabled:!1})})),b&&""!==b&&S((function(e){return M(M({},e),{tooltip:b,isTooltipEnabled:!0})}))}),[b]),s((function(){f&&(S((function(e){return M(M({},e),{modification:"",tooltip:"",isTooltipEnabled:!1,isModificationEnabled:!0})})),G([]),X([]),z(!1))}),[f]),s((function(){p(w)}),[w]),s((function(){""===w.original.trim()||""===w.modification.trim()&&""===w.tooltip.trim()||T||O(!0)}),[w]),s((function(){if((null==q?void 0:q.length)>0&&!J){N(!0);var e=setTimeout((function(){N(!1)}),400);return function(){return clearTimeout(e)}}}),[JSON.stringify(q)]),s((function(){if((null==K?void 0:K.length)>0&&!te){P(!0);var e=setTimeout((function(){P(!1)}),400);return function(){return clearTimeout(e)}}}),[JSON.stringify(K)]),s((function(){var e,t,n,r;if(v){Z(!1),ne(!1);var a=null===(e=null==v?void 0:v.conditions_whentoapply)||void 0===e?void 0:e.map((function(e){return e.when_to_apply})),o=null===(t=null==v?void 0:v.conditions_whennottoapply)||void 0===t?void 0:t.map((function(e){return e.when_not_to_apply}));(null===(n=null==v?void 0:v.conditions_whentoapply)||void 0===n?void 0:n.length)&&(G(a),S((function(e){return M(M({},e),{whenToApply:null==a?void 0:a.join(" OR ")})}))),(null===(r=null==v?void 0:v.conditions_whennottoapply)||void 0===r?void 0:r.length)&&(X(o),S((function(e){return M(M({},e),{whenNotToApply:null==o?void 0:o.join(" OR ")})})))}}),[v]);var ie=i(null),le=l((function(){ie.current&&clearTimeout(ie.current),ie.current=setTimeout((function(){g(!0)}),1e3)}),[]),se=l((function(e){return function(t){S((function(n){var r;return M(M({},n),((r={})[e]=t.target.value,r))})),le()}}),[le]);l((function(e){var t=e.replace(new RegExp("<".concat(o,">"),"gi"),"").replace(new RegExp("</".concat(o,">"),"gi"),"").replace(/<\/?[^>]+(>|$)/g,"");S((function(e){return M(M({},e),{tooltip:t})})),le()}),[le]);var he,de=function(){console.log("Form submitted:",w),oe(!0),""===(null==w?void 0:w.modification)&&S((function(e){return M(M({},e),{isModificationEnabled:!1})})),""===(null==w?void 0:w.tooltip)&&S((function(e){return M(M({},e),{isTooltipEnabled:!1})})),m(w,oe)};return s((function(){E&&de()}),[E]),e(Yj,M({p:0,className:j8,sx:{display:"flex",flexDirection:"column",height:"100%",width:"100%"}},{children:[n(Yj,{children:n(iF,M({sx:{fontSize:20,fontWeight:600,fontFamily:"Plus Jakarta Sans"}},{children:"Instant Learning"}))}),e(Yj,M({sx:{fontFamily:"Plus Jakarta Sans",display:"flex",flexDirection:"column",gap:2,justifyContent:"space-between",flexGrow:1,paddingTop:"20px",height:"calc(100% - 30px)",overflow:"hidden"}},{children:[e(Yj,M({sx:{display:"flex",flexDirection:"column",gap:"20px",height:"calc(100% - 90px)",overflow:"hidden"}},{children:[n(Yj,M({sx:{display:"flex",gap:1}},{children:e(Yj,M({sx:{flex:1}},{children:[e(Yj,M({sx:{display:"flex",alignItems:"center"}},{children:[e(iF,M({sx:{fontFamily:"Plus Jakarta Sans",fontSize:"1rem",fontWeight:600,display:"flex",alignItems:"center"}},{children:["User Query"," ",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"}))]})),n(YZ,{sx:{visibility:"hidden"},disabled:!0})]})),n(j2,{sx:{"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"}},id:"original",value:w.userQuery,onChange:se("userQuery"),fullWidth:!0,placeholder:"Enter your query"})]}))})),n(A7,{options:C,setSelectedTemplate:U}),e(Yj,M({sx:{display:"flex",gap:2,height:"".concat(w.isTooltipEnabled?"calc(100% - 248px)":"calc(100% - 200px)")}},{children:[!(null==q?void 0:q.length)&&e(Yj,M({sx:{flex:1}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When To Apply",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Specific situations or conditions where this learning should be applied.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 84px)",display:"flex",flexDirection:"column"}},{children:[e("div",M({style:{width:"100%",display:"flex",gap:"0.25rem"}},{children:[e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),n("div",M({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:e("div",M({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[n("div",M({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),e("div",M({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[n("div",M({style:{}},{children:"Tell us about your learning in "})),n("span",M({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",n("span",{children:"Chat"})]}))]}))}))]}))]})),(null==q?void 0:q.length)>0&&e(Yj,M({sx:{flex:1,height:"100%"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans, sans-serif",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When To Apply",n(Yj,M({component:"span",sx:{color:"red"}},{children:"*"})),n(LJ,M({title:"Specific situations or conditions where this learning should be applied.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 84px)",boxShadow:R?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",marginLeft:"4px"}},{children:[e(Yj,M({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:[e(Yj,M({display:"flex",gap:"0.25rem",alignItems:"center"},{children:[u&&n(Yj,{component:"img",src:u,alt:"Chat",sx:{width:14,height:14}}),e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),(null==q?void 0:q.length)>0&&n(LJ,M({title:J?"Save & Lock":"Edit",componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(UP,M({disabled:q.some((function(e){return""===(null==e?void 0:e.trim())})),onClick:function(){return Z((function(e){return!e}))},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:n(J?w7:T7,{fontSize:"small"})}))}))]})),n(Yj,M({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:n("ol",M({style:{paddingLeft:"0rem",fontFamily:"Plus Jakarta Sans",margin:0}},{children:R?e(Yj,M({sx:{display:"flex",justifyContent:"center",py:2,gap:2}},{children:[n(xW,{size:24}),n("span",{children:"Generating When to apply..."})]})):n(Yj,M({sx:{pt:"16px"}},{children:q.map((function(t,r){return e(Yj,M({sx:{display:"flex",alignItems:"flex-start",gap:1,mb:r<q.length-1?2:0,fontFamily:"Plus Jakarta Sans"},component:"li"},{children:[n(j2,{variant:"outlined",disabled:!J,fullWidth:!0,multiline:!0,value:"".concat(t),error:!t.trim(),onChange:function(e){var t=V([],q,!0);t[r]=e.target.value,G(t),S((function(e){return M(M({},e),{whenToApply:t.join(" OR ")})}))},InputProps:{startAdornment:e(VG,M({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[r+1,"."]}))},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}}}),J&&n(UP,M({onClick:function(){if(q.length>1){var e=q.filter((function(e,t){return t!==r}));G(e),S((function(t){return M(M({},t),{whenToApply:e.join(" OR ")})}))}},sx:{mt:1}},{children:n(V7,{})}))]}),r)}))}))}))}))]}))]})),!(null==K?void 0:K.length)&&e(Yj,M({sx:{flex:1}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When Not To Apply",n(LJ,M({title:"Cases where this learning should not be applied to avoid incorrect responses.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,flex:1,display:"flex",flexDirection:"column",height:"calc(100% - 84px)"}},{children:[e("div",M({style:{width:"100%",display:"flex",gap:"0.25rem"}},{children:[e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),n("div",M({style:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},{children:e("div",M({style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",paddingTop:"1rem",paddingBottom:"1rem"}},{children:[n("div",M({style:{fontWeight:"700",color:"#6b7280"}},{children:"No suggestions found"})),e("div",M({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"0.25rem",fontSize:"1rem",flexFlow:"wrap"}},{children:[n("div",M({style:{}},{children:"Tell us about your learning in "})),n("span",M({style:{color:"#5928ED",fontWeight:"700"}},{children:"InstantLearning.AI"}))," ",n("span",{children:"Chat"})]}))]}))}))]}))]})),(null==K?void 0:K.length)>0&&e(Yj,M({sx:{flex:1,height:"100%"}},{children:[e(iF,M({sx:{fontSize:"1rem",fontWeight:600,marginBottom:"8px",fontFamily:"Plus Jakarta Sans",display:"flex",alignItems:"center"},gutterBottom:!0},{children:["When Not To Apply",n(LJ,M({title:"Cases where this learning should not be applied to avoid incorrect responses.",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(e7,{size:16,style:{paddingLeft:"0.25rem"}})}))]})),e(Yj,M({sx:{border:"1px solid #ccc",borderRadius:"8px",padding:2,height:"calc(100% - 84px)",boxShadow:D?"0 0 12px 3px rgba(34, 197, 94, 0.6)":"none",transition:"box-shadow 0.3s ease-in-out",marginRight:"4px"}},{children:[e(Yj,M({display:"flex",alignItems:"center",justifyContent:"space-between",sx:{mb:"8px"}},{children:[e(Yj,M({display:"flex",gap:"0.25rem",alignItems:"center"},{children:[u&&n(Yj,{component:"img",src:u,alt:"Chat",sx:{width:14,height:14}}),e("svg",M({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n("g",M({id:"bi:stars","clip-path":"url(#clip0_6004_60631)"},{children:n("path",{id:"Vector",d:"M11.4867 9.37021C11.6517 8.87521 12.3507 8.87521 12.5157 9.37021L13.4832 12.2757C13.6961 12.9144 14.0549 13.4947 14.5311 13.9707C15.0073 14.4466 15.5879 14.8051 16.2267 15.0177L19.1307 15.9852C19.6257 16.1502 19.6257 16.8492 19.1307 17.0142L16.2252 17.9817C15.5865 18.1947 15.0062 18.5535 14.5302 19.0297C14.0543 19.5059 13.6958 20.0864 13.4832 20.7252L12.5157 23.6292C12.4801 23.7376 12.4112 23.832 12.3188 23.8989C12.2264 23.9658 12.1153 24.0019 12.0012 24.0019C11.8871 24.0019 11.7759 23.9658 11.6835 23.8989C11.5912 23.832 11.5223 23.7376 11.4867 23.6292L10.5192 20.7237C10.3064 20.0852 9.9478 19.505 9.47187 19.029C8.99594 18.5531 8.41572 18.1945 7.77718 17.9817L4.87168 17.0142C4.76329 16.9786 4.6689 16.9097 4.60198 16.8173C4.53506 16.725 4.49904 16.6138 4.49904 16.4997C4.49904 16.3856 4.53506 16.2745 4.60198 16.1821C4.6689 16.0897 4.76329 16.0208 4.87168 15.9852L7.77718 15.0177C8.41572 14.8049 8.99594 14.4463 9.47187 13.9704C9.9478 13.4945 10.3064 12.9142 10.5192 12.2757L11.4867 9.37021ZM5.69218 1.72171C5.71369 1.65675 5.75512 1.60022 5.8106 1.56016C5.86607 1.52009 5.93275 1.49853 6.00118 1.49853C6.06961 1.49853 6.13629 1.52009 6.19176 1.56016C6.24724 1.60022 6.28867 1.65675 6.31018 1.72171L6.89068 3.46471C7.15018 4.24171 7.75918 4.85071 8.53618 5.11021L10.2792 5.69071C10.3441 5.71222 10.4007 5.75365 10.4407 5.80912C10.4808 5.86459 10.5024 5.93128 10.5024 5.99971C10.5024 6.06813 10.4808 6.13482 10.4407 6.19029C10.4007 6.24576 10.3441 6.2872 10.2792 6.30871L8.53618 6.88921C8.15274 7.01647 7.80431 7.23149 7.51864 7.51717C7.23296 7.80284 7.01794 8.15127 6.89068 8.53471L6.31018 10.2777C6.28867 10.3427 6.24724 10.3992 6.19176 10.4393C6.13629 10.4793 6.06961 10.5009 6.00118 10.5009C5.93275 10.5009 5.86607 10.4793 5.8106 10.4393C5.75512 10.3992 5.71369 10.3427 5.69218 10.2777L5.11168 8.53471C4.98442 8.15127 4.7694 7.80284 4.48372 7.51717C4.19805 7.23149 3.84962 7.01647 3.46618 6.88921L1.72318 6.30871C1.65822 6.2872 1.60169 6.24576 1.56163 6.19029C1.52156 6.13482 1.5 6.06813 1.5 5.99971C1.5 5.93128 1.52156 5.86459 1.56163 5.80912C1.60169 5.75365 1.65822 5.71222 1.72318 5.69071L3.46618 5.11021C3.84962 4.98295 4.19805 4.76792 4.48372 4.48225C4.7694 4.19657 4.98442 3.84815 5.11168 3.46471L5.69218 1.72171ZM16.2957 0.148207C16.3105 0.105497 16.3382 0.068461 16.3751 0.0422495C16.4119 0.016038 16.456 0.00195312 16.5012 0.00195312C16.5464 0.00195313 16.5905 0.016038 16.6273 0.0422495C16.6641 0.068461 16.6919 0.105497 16.7067 0.148207L17.0937 1.30921C17.2662 1.82821 17.6727 2.23471 18.1917 2.40721L19.3527 2.79421C19.3954 2.80901 19.4324 2.83676 19.4586 2.87359C19.4848 2.91042 19.4989 2.9545 19.4989 2.99971C19.4989 3.04491 19.4848 3.08899 19.4586 3.12582C19.4324 3.16265 19.3954 3.1904 19.3527 3.20521L18.1917 3.59221C17.9361 3.67771 17.7039 3.82139 17.5134 4.01193C17.3229 4.20247 17.1792 4.43467 17.0937 4.69021L16.7067 5.85121C16.6919 5.89392 16.6641 5.93095 16.6273 5.95717C16.5905 5.98338 16.5464 5.99746 16.5012 5.99746C16.456 5.99746 16.4119 5.98338 16.3751 5.95717C16.3382 5.93095 16.3105 5.89392 16.2957 5.85121L15.9087 4.69021C15.8232 4.43467 15.6795 4.20247 15.489 4.01193C15.2984 3.82139 15.0662 3.67771 14.8107 3.59221L13.6512 3.20521C13.6085 3.1904 13.5714 3.16265 13.5452 3.12582C13.519 3.08899 13.5049 3.04491 13.5049 2.99971C13.5049 2.9545 13.519 2.91042 13.5452 2.87359C13.5714 2.83676 13.6085 2.80901 13.6512 2.79421L14.8122 2.40721C15.3312 2.23471 15.7377 1.82821 15.9102 1.30921L16.2957 0.148207Z",fill:"#5928ed"})})),n("defs",{children:n("clipPath",M({id:"clip0_6004_60631"},{children:n("rect",{width:"24",height:"24",fill:"white"})}))})]})),n(iF,M({variant:"body1",sx:{ml:u?1:0,fontWeight:"600",fontFamily:"Plus Jakarta Sans",color:"#5928ed"}},{children:"AI Suggestions"}))]})),(null==K?void 0:K.length)>0&&n(LJ,M({placement:"top",arrow:!0,title:te?"Save & Lock":"Edit",componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n(UP,M({disabled:K.some((function(e){return""===(null==e?void 0:e.trim())})),onClick:function(){return ne((function(e){return!e}))},size:"small",sx:{color:"gray","&:hover":{color:"black"}}},{children:n(te?w7:T7,{fontSize:"small"})}))}))]})),n(Yj,M({sx:{height:"calc(100% - 38px)",overflow:"auto"}},{children:n("ol",M({style:{paddingLeft:"0rem",margin:0}},{children:D?e(Yj,M({sx:{display:"flex",justifyContent:"center",py:2,gap:2}},{children:[n(xW,{size:24}),n("span",{children:"Generating When not to apply..."})]})):n(Yj,M({sx:{pt:"16px"}},{children:K.map((function(t,r){return e(Yj,M({sx:{display:"flex",alignItems:"flex-start",gap:1,mb:r<K.length-1?2:0},component:"li"},{children:[n(j2,{variant:"outlined",disabled:!te,fullWidth:!0,multiline:!0,value:"".concat(t),error:!t.trim(),onChange:function(e){var t=V([],K,!0);t[r]=e.target.value,X(t),S((function(e){return M(M({},e),{whenNotToApply:t.join(" OR ")})}))},InputProps:{startAdornment:e(VG,M({position:"start",sx:{color:"#000",alignSelf:"flex-start",paddingTop:"12px"}},{children:[r+1,"."]}))},sx:{backgroundColor:"#f9fafb",borderRadius:1,"& .MuiInputBase-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputBase-input.Mui-disabled":{color:"#000",WebkitTextFillColor:"#000"},"& .MuiInputLabel-root":{fontFamily:"Plus Jakarta Sans, sans-serif"},"& .MuiInputLabel-root.Mui-disabled":{color:"rgba(0, 0, 0, 0.6)"}}}),te&&n(UP,M({onClick:function(){if(K.length>1){var e=K.filter((function(e,t){return t!==r}));X(e),S((function(t){return M(M({},t),{whenNotToApply:e.join(" OR ")})}))}},disabled:1===K.length,sx:{mt:1}},{children:n(V7,{})}))]}),r)}))}))}))}))]}))]}))]}))]})),e(Yj,M({sx:{display:"flex",gap:2}},{children:[e(Yj,M({sx:{flex:1}},{children:[n(iF,M({sx:{fontSize:"1rem",fontWeight:600,fontFamily:"Plus Jakarta Sans"},gutterBottom:!0},{children:"Scope"})),n(tq,M({sx:{width:"50%",fontFamily:"Plus Jakarta Sans"},variant:"outlined"},{children:e(iQ,M({id:"scope",value:w.scope,onChange:(he="scope",function(e){S((function(t){var n;return M(M({},t),((n={})[he]=e.target.value,n))}))}),displayEmpty:!0,sx:{fontFamily:"Plus Jakarta Sans"},fullWidth:!0},{children:[n(dK,M({value:"",disabled:!0},{children:"Select scope"})),a.map((function(e,t){return n(dK,M({value:e.value,sx:{fontFamily:"Plus Jakarta Sans"}},{children:e.labelText}),t)}))]}))}))]})),n(Yj,M({sx:{flex:1,display:"flex",alignItems:"flex-end",justifyContent:"flex-end"}},{children:e(zU,M({variant:"contained",onClick:de,sx:{width:"30%",height:"56px",fontFamily:"Plus Jakarta Sans",backgroundColor:"green",textTransform:"capitalize","&:hover":{backgroundColor:"#006400"}},disabled:!ce},{children:[ae&&n(xW,{sx:{marginRight:"8px",color:"#fff"},size:16}),ae?"Saving":"Save"]}))}))]}))]}))]}))},N7=function(r){var a=r.open,o=r.selectedText,i=r.scopeOptions,l=r.devModeTag,s=r.submitFunction,h=r.chatAssistantName,d=r.organizationName,u=r.baseUrl,m=r.baseWebsocketUrl,p=r.chatAssistantLogoUrl,v=r.ChatIconComponent,f=r.ggcAssistantName,z=r.closeFunction,g=r.ThinkingBulbIconComponent,y=r.template,E=void 0===y?"":y,b=r.userQuery,H=void 0===b?"":b,V=r.topic,C=void 0===V?"":V,L=r.templateOptions,k=void 0===L?[]:L,w=c(a),S=w[0],x=w[1],T=c(!1),O=T[0],A=T[1],R=c(!1),N=R[0],_=R[1],D=c({}),P=D[0],F=D[1],I=c(null),B=I[0],j=I[1],U=c(!1),W=U[0],$=U[1],q=c(!1),G=q[0],Y=q[1],K=c(null),X=K[0],Q=K[1],J=c(""),Z=J[0],ee=J[1],te=c(!1),ne=te[0],re=te[1],ae=c(!1),oe=ae[0],ce=ae[1],ie=function(){x(!1),z()};return n(t,{children:e(a$,M({open:S,onClose:ie,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:"95vw",height:"100vh",display:"flex",flexDirection:"column",margin:0,maxWidth:"100vw"}}},{children:[n(UP,M({"aria-label":"close",onClick:ie,sx:{position:"absolute",right:8,top:8,zIndex:1,color:function(e){return e.palette.grey[500]}}},{children:n("svg",M({width:"28px",height:"28px",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"#000000"},{children:n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.707.708L7.293 8l-3.646 3.646.707.708L8 8.707z"})}))})),e(p$,M({sx:{flex:1,overflow:"auto",display:"flex",flexDirection:"row",gap:2}},{children:[n(Yj,M({sx:{minWidth:"350px",maxWidth:"35%",bgcolor:"#f5f5f5",p:0,borderRadius:1,display:"flex",flexDirection:"column"}},{children:n(d7,{chatAssistantLogoUrl:p||"",chatAssistantName:h,organizationName:d,baseUrl:u,setInstantLearningSuggestions:F,formDataState:B,hasUserFilledForm:N,setHasUserFilledForm:_,baseWebsocketUrl:m,setIsNewChatClicked:$,selectedText:o,ChatIconComponent:v,ggcAssistantName:f||"",ThinkingBulbIconComponent:g,hasUserWrittenModification:G,setExtractedModification:Q,setSave:re,setExtractedTooltip:ee,setIsSaveLoading:ce,isSaveLoading:oe,save:ne,instantLearningSuggestions:P,template:E})})),n(Yj,M({sx:{minWidth:"65%",maxWidth:"65%",display:"flex",flexDirection:"column"}},{children:"TemplateRetrieval"===E?n(R7,{selectedText:o,scopeOptions:i||[],devModeTag:l||"",submitFunction:s,setShowChat:A,showChat:O,setFormDataState:j,instantLearningSuggestions:P,setHasUserFilledForm:_,hasUserFilledForm:N,isNewChatClicked:W,setIsNewChatClicked:$,setHasUserWrittenModification:Y,extractedModification:X,save:ne,extractedTooltip:Z,isSaveLoading:oe,template:E,userQuery:H,templateOptions:k,topic:C}):n(O7,{selectedText:o,scopeOptions:i||[],devModeTag:l||"",submitFunction:s,setShowChat:A,showChat:O,setFormDataState:j,instantLearningSuggestions:P,setHasUserFilledForm:_,hasUserFilledForm:N,isNewChatClicked:W,setIsNewChatClicked:$,setHasUserWrittenModification:Y,extractedModification:X,save:ne,extractedTooltip:Z,isSaveLoading:oe})}))]}))]}))})},_7="PdfEditorCitation-module_citationRoot__5OtUI",D7="PdfEditorCitation-module_citationTitle__X9kQm",P7="PdfEditorCitation-module_citationBody__C99jX",F7="PdfEditorCitation-module_citationBodyWhenCollapsed__8vG0V";C(".PdfEditorCitation-module_citationRoot__5OtUI{display:flex;flex-direction:column}.PdfEditorCitation-module_citationTitle__X9kQm{align-items:center;background-color:#eff6ff;border:1px solid #000;border-radius:10px;cursor:pointer;display:inline-flex;gap:10px;padding:5px 8px;width:fit-content}.PdfEditorCitation-module_citationBody__C99jX{background-color:#fff;flex-grow:1}.PdfEditorCitation-module_citationBodyWhenCollapsed__8vG0V{display:none}.PdfEditorCitation-module_citationBodyWhenFullScreen__VKtop{bottom:0;height:100%!important;left:0;max-height:100%;position:absolute;right:0;top:0;width:100%!important}");var I7,B7={};var j7,U7=function(){if(I7)return B7;I7=1;var e=p_(),t=f7();Object.defineProperty(B7,"__esModule",{value:!0}),B7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");return B7.default=r,B7}(),W7=xe(U7),$7={};var q7=function(){if(j7)return $7;j7=1;var e=p_(),t=f7();Object.defineProperty($7,"__esModule",{value:!0}),$7.default=void 0;var n=t(a),r=(0,e(E7()).default)(n.createElement("path",{d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore");return $7.default=r,$7}(),G7=xe(q7),Y7=function(){return Y7=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Y7.apply(this,arguments)};function K7(e,t,n,r){return new(n||(n=Promise))((function(a,o){function c(e){try{l(r.next(e))}catch(e){o(e)}}function i(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?a(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(c,i)}l((r=r.apply(e,t||[])).next())}))}function X7(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=i(0),c.throw=i(1),c.return=i(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function i(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c&&(c=0,i[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function Q7(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var J7=void 0!==ot?ot:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Z7(){throw new Error("setTimeout has not been defined")}function eee(){throw new Error("clearTimeout has not been defined")}var tee=Z7,nee=eee;function ree(e){if(tee===setTimeout)return setTimeout(e,0);if((tee===Z7||!tee)&&setTimeout)return tee=setTimeout,setTimeout(e,0);try{return tee(e,0)}catch(t){try{return tee.call(null,e,0)}catch(t){return tee.call(this,e,0)}}}"function"==typeof J7.setTimeout&&(tee=setTimeout),"function"==typeof J7.clearTimeout&&(nee=clearTimeout);var aee,oee=[],cee=!1,iee=-1;function lee(){cee&&aee&&(cee=!1,aee.length?oee=aee.concat(oee):iee=-1,oee.length&&see())}function see(){if(!cee){var e=ree(lee);cee=!0;for(var t=oee.length;t;){for(aee=oee,oee=[];++iee<t;)aee&&aee[iee].run();iee=-1,t=oee.length}aee=null,cee=!1,function(e){if(nee===clearTimeout)return clearTimeout(e);if((nee===eee||!nee)&&clearTimeout)return nee=clearTimeout,clearTimeout(e);try{return nee(e)}catch(t){try{return nee.call(null,e)}catch(t){return nee.call(this,e)}}}(e)}}function hee(e,t){this.fun=e,this.array=t}function dee(){}hee.prototype.run=function(){this.fun.apply(null,this.array)};var uee=dee,mee=dee,pee=dee,vee=dee,fee=dee,zee=dee,gee=dee,yee=J7.performance||{},Mee=yee.now||yee.mozNow||yee.msNow||yee.oNow||yee.webkitNow||function(){return(new Date).getTime()},Eee=new Date,bee={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];oee.push(new hee(e,t)),1!==oee.length||cee||ree(see)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:uee,addListener:mee,once:pee,off:vee,removeListener:fee,removeAllListeners:zee,emit:gee,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Mee.call(yee),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Eee)/1e3}};function Hee(e,t){return function(){return e.apply(t,arguments)}}const{toString:Vee}=Object.prototype,{getPrototypeOf:Cee}=Object,Lee=(Tee=Object.create(null),e=>{const t=Vee.call(e);return Tee[t]||(Tee[t]=t.slice(8,-1).toLowerCase())}),kee=e=>(e=e.toLowerCase(),t=>Lee(t)===e),wee=e=>t=>typeof t===e,{isArray:See}=Array,xee=wee("undefined");var Tee;const Oee=kee("ArrayBuffer"),Aee=wee("string"),Ree=wee("function"),Nee=wee("number"),_ee=e=>null!==e&&"object"==typeof e,Dee=e=>{if("object"!==Lee(e))return!1;const t=Cee(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Pee=kee("Date"),Fee=kee("File"),Iee=kee("Blob"),Bee=kee("FileList"),jee=kee("URLSearchParams"),[Uee,Wee,$ee,qee]=["ReadableStream","Request","Response","Headers"].map(kee);function Gee(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,a;if("object"!=typeof e&&(e=[e]),See(e))for(r=0,a=e.length;r<a;r++)t.call(null,e[r],r,e);else{const a=n?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let c;for(r=0;r<o;r++)c=a[r],t.call(null,e[c],c,e)}}function Yee(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,a=n.length;for(;a-- >0;)if(r=n[a],t===r.toLowerCase())return r;return null}const Kee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:J7,Xee=e=>!xee(e)&&e!==Kee,Qee=(Jee="undefined"!=typeof Uint8Array&&Cee(Uint8Array),e=>Jee&&e instanceof Jee);var Jee;const Zee=kee("HTMLFormElement"),ete=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),tte=kee("RegExp"),nte=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Gee(n,((n,a)=>{let o;!1!==(o=t(n,a,e))&&(r[a]=o||n)})),Object.defineProperties(e,r)},rte="abcdefghijklmnopqrstuvwxyz",ate="0123456789",ote={DIGIT:ate,ALPHA:rte,ALPHA_DIGIT:rte+rte.toUpperCase()+ate},cte=kee("AsyncFunction"),ite=(lte="function"==typeof setImmediate,ste=Ree(Kee.postMessage),lte?setImmediate:ste?(hte=`axios@${Math.random()}`,dte=[],Kee.addEventListener("message",(({source:e,data:t})=>{e===Kee&&t===hte&&dte.length&&dte.shift()()}),!1),e=>{dte.push(e),Kee.postMessage(hte,"*")}):e=>setTimeout(e));var lte,ste,hte,dte;const ute="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Kee):bee.nextTick||ite;var mte={isArray:See,isArrayBuffer:Oee,isBuffer:function(e){return null!==e&&!xee(e)&&null!==e.constructor&&!xee(e.constructor)&&Ree(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ree(e.append)&&("formdata"===(t=Lee(e))||"object"===t&&Ree(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Oee(e.buffer),t},isString:Aee,isNumber:Nee,isBoolean:e=>!0===e||!1===e,isObject:_ee,isPlainObject:Dee,isReadableStream:Uee,isRequest:Wee,isResponse:$ee,isHeaders:qee,isUndefined:xee,isDate:Pee,isFile:Fee,isBlob:Iee,isRegExp:tte,isFunction:Ree,isStream:e=>_ee(e)&&Ree(e.pipe),isURLSearchParams:jee,isTypedArray:Qee,isFileList:Bee,forEach:Gee,merge:function e(){const{caseless:t}=Xee(this)&&this||{},n={},r=(r,a)=>{const o=t&&Yee(n,a)||a;Dee(n[o])&&Dee(r)?n[o]=e(n[o],r):Dee(r)?n[o]=e({},r):See(r)?n[o]=r.slice():n[o]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Gee(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(Gee(t,((t,r)=>{n&&Ree(t)?e[r]=Hee(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let a,o,c;const i={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)c=a[o],r&&!r(c,e,t)||i[c]||(t[c]=e[c],i[c]=!0);e=!1!==n&&Cee(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Lee,kindOfTest:kee,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(See(e))return e;let t=e.length;if(!Nee(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:Zee,hasOwnProperty:ete,hasOwnProp:ete,reduceDescriptors:nte,freezeMethods:e=>{nte(e,((t,n)=>{if(Ree(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Ree(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return See(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Yee,global:Kee,isContextDefined:Xee,ALPHABET:ote,generateString:(e=16,t=ote.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&Ree(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(_ee(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const a=See(e)?[]:{};return Gee(e,((e,t)=>{const o=n(e,r+1);!xee(o)&&(a[t]=o)})),t[r]=void 0,a}}return e};return n(e,0)},isAsyncFn:cte,isThenable:e=>e&&(_ee(e)||Ree(e))&&Ree(e.then)&&Ree(e.catch),setImmediate:ite,asap:ute},pte=[],vte=[],fte="undefined"!=typeof Uint8Array?Uint8Array:Array,zte=!1;function gte(){zte=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)pte[t]=e[t],vte[e.charCodeAt(t)]=t;vte["-".charCodeAt(0)]=62,vte["_".charCodeAt(0)]=63}function yte(e,t,n){for(var r,a,o=[],c=t;c<n;c+=3)r=(e[c]<<16)+(e[c+1]<<8)+e[c+2],o.push(pte[(a=r)>>18&63]+pte[a>>12&63]+pte[a>>6&63]+pte[63&a]);return o.join("")}function Mte(e){var t;zte||gte();for(var n=e.length,r=n%3,a="",o=[],c=16383,i=0,l=n-r;i<l;i+=c)o.push(yte(e,i,i+c>l?l:i+c));return 1===r?(t=e[n-1],a+=pte[t>>2],a+=pte[t<<4&63],a+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],a+=pte[t>>10],a+=pte[t>>4&63],a+=pte[t<<2&63],a+="="),o.push(a),o.join("")}function Ete(e,t,n,r,a){var o,c,i=8*a-r-1,l=(1<<i)-1,s=l>>1,h=-7,d=n?a-1:0,u=n?-1:1,m=e[t+d];for(d+=u,o=m&(1<<-h)-1,m>>=-h,h+=i;h>0;o=256*o+e[t+d],d+=u,h-=8);for(c=o&(1<<-h)-1,o>>=-h,h+=r;h>0;c=256*c+e[t+d],d+=u,h-=8);if(0===o)o=1-s;else{if(o===l)return c?NaN:1/0*(m?-1:1);c+=Math.pow(2,r),o-=s}return(m?-1:1)*c*Math.pow(2,o-r)}function bte(e,t,n,r,a,o){var c,i,l,s=8*o-a-1,h=(1<<s)-1,d=h>>1,u=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,c=h):(c=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-c))<1&&(c--,l*=2),(t+=c+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(c++,l/=2),c+d>=h?(i=0,c=h):c+d>=1?(i=(t*l-1)*Math.pow(2,a),c+=d):(i=t*Math.pow(2,d-1)*Math.pow(2,a),c=0));a>=8;e[n+m]=255&i,m+=p,i/=256,a-=8);for(c=c<<a|i,s+=a;s>0;e[n+m]=255&c,m+=p,c/=256,s-=8);e[n+m-p]|=128*v}var Hte={}.toString,Vte=Array.isArray||function(e){return"[object Array]"==Hte.call(e)};function Cte(){return kte.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Lte(e,t){if(Cte()<t)throw new RangeError("Invalid typed array length");return kte.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=kte.prototype:(null===e&&(e=new kte(t)),e.length=t),e}function kte(e,t,n){if(!(kte.TYPED_ARRAY_SUPPORT||this instanceof kte))return new kte(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return xte(this,e)}return wte(this,e,t,n)}function wte(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),kte.TYPED_ARRAY_SUPPORT?(e=t).__proto__=kte.prototype:e=Tte(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!kte.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Rte(t,n),a=(e=Lte(e,r)).write(t,n);return a!==r&&(e=e.slice(0,a)),e}(e,t,n):function(e,t){if(Ate(t)){var n=0|Ote(t.length);return 0===(e=Lte(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?Lte(e,0):Tte(e,t);if("Buffer"===t.type&&Vte(t.data))return Tte(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Ste(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function xte(e,t){if(Ste(t),e=Lte(e,t<0?0:0|Ote(t)),!kte.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Tte(e,t){var n=t.length<0?0:0|Ote(t.length);e=Lte(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Ote(e){if(e>=Cte())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Cte().toString(16)+" bytes");return 0|e}function Ate(e){return!(null==e||!e._isBuffer)}function Rte(e,t){if(Ate(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ine(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return lne(e).length;default:if(r)return ine(e).length;t=(""+t).toLowerCase(),r=!0}}function Nte(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Xte(this,t,n);case"utf8":case"utf-8":return qte(this,t,n);case"ascii":return Yte(this,t,n);case"latin1":case"binary":return Kte(this,t,n);case"base64":return $te(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qte(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function _te(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Dte(e,t,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof t&&(t=kte.from(t,r)),Ate(t))return 0===t.length?-1:Pte(e,t,n,r,a);if("number"==typeof t)return t&=255,kte.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Pte(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function Pte(e,t,n,r,a){var o,c=1,i=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;c=2,i/=2,l/=2,n/=2}function s(e,t){return 1===c?e[t]:e.readUInt16BE(t*c)}if(a){var h=-1;for(o=n;o<i;o++)if(s(e,o)===s(t,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===l)return h*c}else-1!==h&&(o-=o-h),h=-1}else for(n+l>i&&(n=i-l),o=n;o>=0;o--){for(var d=!0,u=0;u<l;u++)if(s(e,o+u)!==s(t,u)){d=!1;break}if(d)return o}return-1}function Fte(e,t,n,r){n=Number(n)||0;var a=e.length-n;r?(r=Number(r))>a&&(r=a):r=a;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var c=0;c<r;++c){var i=parseInt(t.substr(2*c,2),16);if(isNaN(i))return c;e[n+c]=i}return c}function Ite(e,t,n,r){return sne(ine(t,e.length-n),e,n,r)}function Bte(e,t,n,r){return sne(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function jte(e,t,n,r){return Bte(e,t,n,r)}function Ute(e,t,n,r){return sne(lne(t),e,n,r)}function Wte(e,t,n,r){return sne(function(e,t){for(var n,r,a,o=[],c=0;c<e.length&&!((t-=2)<0);++c)r=(n=e.charCodeAt(c))>>8,a=n%256,o.push(a),o.push(r);return o}(t,e.length-n),e,n,r)}function $te(e,t,n){return 0===t&&n===e.length?Mte(e):Mte(e.slice(t,n))}function qte(e,t,n){n=Math.min(e.length,n);for(var r=[],a=t;a<n;){var o,c,i,l,s=e[a],h=null,d=s>239?4:s>223?3:s>191?2:1;if(a+d<=n)switch(d){case 1:s<128&&(h=s);break;case 2:128==(192&(o=e[a+1]))&&(l=(31&s)<<6|63&o)>127&&(h=l);break;case 3:o=e[a+1],c=e[a+2],128==(192&o)&&128==(192&c)&&(l=(15&s)<<12|(63&o)<<6|63&c)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:o=e[a+1],c=e[a+2],i=e[a+3],128==(192&o)&&128==(192&c)&&128==(192&i)&&(l=(15&s)<<18|(63&o)<<12|(63&c)<<6|63&i)>65535&&l<1114112&&(h=l)}null===h?(h=65533,d=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),a+=d}return function(e){var t=e.length;if(t<=Gte)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Gte));return n}(r)}kte.TYPED_ARRAY_SUPPORT=void 0===J7.TYPED_ARRAY_SUPPORT||J7.TYPED_ARRAY_SUPPORT,Cte(),kte.poolSize=8192,kte._augment=function(e){return e.__proto__=kte.prototype,e},kte.from=function(e,t,n){return wte(null,e,t,n)},kte.TYPED_ARRAY_SUPPORT&&(kte.prototype.__proto__=Uint8Array.prototype,kte.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&kte[Symbol.species]),kte.alloc=function(e,t,n){return function(e,t,n,r){return Ste(t),t<=0?Lte(e,t):void 0!==n?"string"==typeof r?Lte(e,t).fill(n,r):Lte(e,t).fill(n):Lte(e,t)}(null,e,t,n)},kte.allocUnsafe=function(e){return xte(null,e)},kte.allocUnsafeSlow=function(e){return xte(null,e)},kte.isBuffer=function(e){return null!=e&&(!!e._isBuffer||hne(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&hne(e.slice(0,0))}(e))},kte.compare=function(e,t){if(!Ate(e)||!Ate(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,a=0,o=Math.min(n,r);a<o;++a)if(e[a]!==t[a]){n=e[a],r=t[a];break}return n<r?-1:r<n?1:0},kte.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},kte.concat=function(e,t){if(!Vte(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return kte.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=kte.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){var o=e[n];if(!Ate(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,a),a+=o.length}return r},kte.byteLength=Rte,kte.prototype._isBuffer=!0,kte.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)_te(this,t,t+1);return this},kte.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)_te(this,t,t+3),_te(this,t+1,t+2);return this},kte.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)_te(this,t,t+7),_te(this,t+1,t+6),_te(this,t+2,t+5),_te(this,t+3,t+4);return this},kte.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?qte(this,0,e):Nte.apply(this,arguments)},kte.prototype.equals=function(e){if(!Ate(e))throw new TypeError("Argument must be a Buffer");return this===e||0===kte.compare(this,e)},kte.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},kte.prototype.compare=function(e,t,n,r,a){if(!Ate(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===a&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(a>>>=0)-(r>>>=0),c=(n>>>=0)-(t>>>=0),i=Math.min(o,c),l=this.slice(r,a),s=e.slice(t,n),h=0;h<i;++h)if(l[h]!==s[h]){o=l[h],c=s[h];break}return o<c?-1:c<o?1:0},kte.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},kte.prototype.indexOf=function(e,t,n){return Dte(this,e,t,n,!0)},kte.prototype.lastIndexOf=function(e,t,n){return Dte(this,e,t,n,!1)},kte.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var a=this.length-t;if((void 0===n||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return Fte(this,e,t,n);case"utf8":case"utf-8":return Ite(this,e,t,n);case"ascii":return Bte(this,e,t,n);case"latin1":case"binary":return jte(this,e,t,n);case"base64":return Ute(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wte(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},kte.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Gte=4096;function Yte(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;a<n;++a)r+=String.fromCharCode(127&e[a]);return r}function Kte(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;a<n;++a)r+=String.fromCharCode(e[a]);return r}function Xte(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var a="",o=t;o<n;++o)a+=cne(e[o]);return a}function Qte(e,t,n){for(var r=e.slice(t,n),a="",o=0;o<r.length;o+=2)a+=String.fromCharCode(r[o]+256*r[o+1]);return a}function Jte(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function Zte(e,t,n,r,a,o){if(!Ate(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function ene(e,t,n,r){t<0&&(t=65535+t+1);for(var a=0,o=Math.min(e.length-n,2);a<o;++a)e[n+a]=(t&255<<8*(r?a:1-a))>>>8*(r?a:1-a)}function tne(e,t,n,r){t<0&&(t=4294967295+t+1);for(var a=0,o=Math.min(e.length-n,4);a<o;++a)e[n+a]=t>>>8*(r?a:3-a)&255}function nne(e,t,n,r,a,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function rne(e,t,n,r,a){return a||nne(e,0,n,4),bte(e,t,n,r,23,4),n+4}function ane(e,t,n,r,a){return a||nne(e,0,n,8),bte(e,t,n,r,52,8),n+8}kte.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),kte.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=kte.prototype;else{var a=t-e;n=new kte(a,void 0);for(var o=0;o<a;++o)n[o]=this[o+e]}return n},kte.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Jte(e,t,this.length);for(var r=this[e],a=1,o=0;++o<t&&(a*=256);)r+=this[e+o]*a;return r},kte.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Jte(e,t,this.length);for(var r=this[e+--t],a=1;t>0&&(a*=256);)r+=this[e+--t]*a;return r},kte.prototype.readUInt8=function(e,t){return t||Jte(e,1,this.length),this[e]},kte.prototype.readUInt16LE=function(e,t){return t||Jte(e,2,this.length),this[e]|this[e+1]<<8},kte.prototype.readUInt16BE=function(e,t){return t||Jte(e,2,this.length),this[e]<<8|this[e+1]},kte.prototype.readUInt32LE=function(e,t){return t||Jte(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},kte.prototype.readUInt32BE=function(e,t){return t||Jte(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},kte.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Jte(e,t,this.length);for(var r=this[e],a=1,o=0;++o<t&&(a*=256);)r+=this[e+o]*a;return r>=(a*=128)&&(r-=Math.pow(2,8*t)),r},kte.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Jte(e,t,this.length);for(var r=t,a=1,o=this[e+--r];r>0&&(a*=256);)o+=this[e+--r]*a;return o>=(a*=128)&&(o-=Math.pow(2,8*t)),o},kte.prototype.readInt8=function(e,t){return t||Jte(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},kte.prototype.readInt16LE=function(e,t){t||Jte(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},kte.prototype.readInt16BE=function(e,t){t||Jte(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},kte.prototype.readInt32LE=function(e,t){return t||Jte(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},kte.prototype.readInt32BE=function(e,t){return t||Jte(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},kte.prototype.readFloatLE=function(e,t){return t||Jte(e,4,this.length),Ete(this,e,!0,23,4)},kte.prototype.readFloatBE=function(e,t){return t||Jte(e,4,this.length),Ete(this,e,!1,23,4)},kte.prototype.readDoubleLE=function(e,t){return t||Jte(e,8,this.length),Ete(this,e,!0,52,8)},kte.prototype.readDoubleBE=function(e,t){return t||Jte(e,8,this.length),Ete(this,e,!1,52,8)},kte.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||Zte(this,e,t,n,Math.pow(2,8*n)-1,0);var a=1,o=0;for(this[t]=255&e;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},kte.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||Zte(this,e,t,n,Math.pow(2,8*n)-1,0);var a=n-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},kte.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,1,255,0),kte.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},kte.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,2,65535,0),kte.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ene(this,e,t,!0),t+2},kte.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,2,65535,0),kte.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ene(this,e,t,!1),t+2},kte.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,4,4294967295,0),kte.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):tne(this,e,t,!0),t+4},kte.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,4,4294967295,0),kte.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):tne(this,e,t,!1),t+4},kte.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);Zte(this,e,t,n,a-1,-a)}var o=0,c=1,i=0;for(this[t]=255&e;++o<n&&(c*=256);)e<0&&0===i&&0!==this[t+o-1]&&(i=1),this[t+o]=(e/c|0)-i&255;return t+n},kte.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);Zte(this,e,t,n,a-1,-a)}var o=n-1,c=1,i=0;for(this[t+o]=255&e;--o>=0&&(c*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/c|0)-i&255;return t+n},kte.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,1,127,-128),kte.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},kte.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,2,32767,-32768),kte.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ene(this,e,t,!0),t+2},kte.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,2,32767,-32768),kte.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ene(this,e,t,!1),t+2},kte.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,4,2147483647,-2147483648),kte.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):tne(this,e,t,!0),t+4},kte.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Zte(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),kte.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):tne(this,e,t,!1),t+4},kte.prototype.writeFloatLE=function(e,t,n){return rne(this,e,t,!0,n)},kte.prototype.writeFloatBE=function(e,t,n){return rne(this,e,t,!1,n)},kte.prototype.writeDoubleLE=function(e,t,n){return ane(this,e,t,!0,n)},kte.prototype.writeDoubleBE=function(e,t,n){return ane(this,e,t,!1,n)},kte.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var a,o=r-n;if(this===e&&n<t&&t<r)for(a=o-1;a>=0;--a)e[a+t]=this[a+n];else if(o<1e3||!kte.TYPED_ARRAY_SUPPORT)for(a=0;a<o;++a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},kte.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var a=e.charCodeAt(0);a<256&&(e=a)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!kte.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var c=Ate(e)?e:ine(new kte(e,r).toString()),i=c.length;for(o=0;o<n-t;++o)this[o+t]=c[o%i]}return this};var one=/[^+\/0-9A-Za-z-_]/g;function cne(e){return e<16?"0"+e.toString(16):e.toString(16)}function ine(e,t){var n;t=t||1/0;for(var r=e.length,a=null,o=[],c=0;c<r;++c){if((n=e.charCodeAt(c))>55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(c+1===r){(t-=3)>-1&&o.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&o.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function lne(e){return function(e){var t,n,r,a,o,c;zte||gte();var i=e.length;if(i%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[i-2]?2:"="===e[i-1]?1:0,c=new fte(3*i/4-o),r=o>0?i-4:i;var l=0;for(t=0,n=0;t<r;t+=4,n+=3)a=vte[e.charCodeAt(t)]<<18|vte[e.charCodeAt(t+1)]<<12|vte[e.charCodeAt(t+2)]<<6|vte[e.charCodeAt(t+3)],c[l++]=a>>16&255,c[l++]=a>>8&255,c[l++]=255&a;return 2===o?(a=vte[e.charCodeAt(t)]<<2|vte[e.charCodeAt(t+1)]>>4,c[l++]=255&a):1===o&&(a=vte[e.charCodeAt(t)]<<10|vte[e.charCodeAt(t+1)]<<4|vte[e.charCodeAt(t+2)]>>2,c[l++]=a>>8&255,c[l++]=255&a),c}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(one,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function sne(e,t,n,r){for(var a=0;a<r&&!(a+n>=t.length||a>=e.length);++a)t[a+n]=e[a];return a}function hne(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function dne(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}mte.inherits(dne,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:mte.toJSONObject(this.config),code:this.code,status:this.status}}});const une=dne.prototype,mne={};function pne(e){return mte.isPlainObject(e)||mte.isArray(e)}function vne(e){return mte.endsWith(e,"[]")?e.slice(0,-2):e}function fne(e,t,n){return e?e.concat(t).map((function(e,t){return e=vne(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{mne[e]={value:e}})),Object.defineProperties(dne,mne),Object.defineProperty(une,"isAxiosError",{value:!0}),dne.from=(e,t,n,r,a,o)=>{const c=Object.create(une);return mte.toFlatObject(e,c,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),dne.call(c,e.message,t,n,r,a),c.cause=e,c.name=e.name,o&&Object.assign(c,o),c};const zne=mte.toFlatObject(mte,{},null,(function(e){return/^is[A-Z]/.test(e)}));function gne(e,t,n){if(!mte.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=mte.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!mte.isUndefined(t[e])}))).metaTokens,a=n.visitor||s,o=n.dots,c=n.indexes,i=(n.Blob||"undefined"!=typeof Blob&&Blob)&&mte.isSpecCompliantForm(t);if(!mte.isFunction(a))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(mte.isDate(e))return e.toISOString();if(!i&&mte.isBlob(e))throw new dne("Blob is not supported. Use a Buffer instead.");return mte.isArrayBuffer(e)||mte.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):kte.from(e):e}function s(e,n,a){let i=e;if(e&&!a&&"object"==typeof e)if(mte.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(mte.isArray(e)&&function(e){return mte.isArray(e)&&!e.some(pne)}(e)||(mte.isFileList(e)||mte.endsWith(n,"[]"))&&(i=mte.toArray(e)))return n=vne(n),i.forEach((function(e,r){!mte.isUndefined(e)&&null!==e&&t.append(!0===c?fne([n],r,o):null===c?n:n+"[]",l(e))})),!1;return!!pne(e)||(t.append(fne(a,n,o),l(e)),!1)}const h=[],d=Object.assign(zne,{defaultVisitor:s,convertValue:l,isVisitable:pne});if(!mte.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!mte.isUndefined(n)){if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),mte.forEach(n,(function(n,o){!0===(!(mte.isUndefined(n)||null===n)&&a.call(t,n,mte.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])})),h.pop()}}(e),t}function yne(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Mne(e,t){this._pairs=[],e&&gne(e,this,t)}const Ene=Mne.prototype;function bne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Hne(e,t,n){if(!t)return e;const r=n&&n.encode||bne;mte.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let o;if(o=a?a(t,n):mte.isURLSearchParams(t)?t.toString():new Mne(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Ene.append=function(e,t){this._pairs.push([e,t])},Ene.toString=function(e){const t=e?function(t){return e.call(this,t,yne)}:yne;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Vne{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){mte.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Cne={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Lne={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Mne,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const kne="undefined"!=typeof window&&"undefined"!=typeof document,wne="object"==typeof navigator&&navigator||void 0,Sne=kne&&(!wne||["ReactNative","NativeScript","NS"].indexOf(wne.product)<0),xne="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Tne=kne&&window.location.href||"http://localhost";var One={...Object.freeze({__proto__:null,hasBrowserEnv:kne,hasStandardBrowserWebWorkerEnv:xne,hasStandardBrowserEnv:Sne,navigator:wne,origin:Tne}),...Lne};function Ane(e){function t(e,n,r,a){let o=e[a++];if("__proto__"===o)return!0;const c=Number.isFinite(+o),i=a>=e.length;return o=!o&&mte.isArray(r)?r.length:o,i?(mte.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!c):(r[o]&&mte.isObject(r[o])||(r[o]=[]),t(e,n,r[o],a)&&mte.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const a=n.length;let o;for(r=0;r<a;r++)o=n[r],t[o]=e[o];return t}(r[o])),!c)}if(mte.isFormData(e)&&mte.isFunction(e.entries)){const n={};return mte.forEachEntry(e,((e,r)=>{t(function(e){return mte.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const Rne={transitional:Cne,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,a=mte.isObject(e);if(a&&mte.isHTMLForm(e)&&(e=new FormData(e)),mte.isFormData(e))return r?JSON.stringify(Ane(e)):e;if(mte.isArrayBuffer(e)||mte.isBuffer(e)||mte.isStream(e)||mte.isFile(e)||mte.isBlob(e)||mte.isReadableStream(e))return e;if(mte.isArrayBufferView(e))return e.buffer;if(mte.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return gne(e,new One.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return One.isNode&&mte.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=mte.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return gne(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||r?(t.setContentType("application/json",!1),function(e){if(mte.isString(e))try{return(0,JSON.parse)(e),mte.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Rne.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(mte.isResponse(e)||mte.isReadableStream(e))return e;if(e&&mte.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw dne.from(e,dne.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:One.classes.FormData,Blob:One.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};mte.forEach(["delete","get","head","post","put","patch"],(e=>{Rne.headers[e]={}}));const Nne=mte.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),_ne=Symbol("internals");function Dne(e){return e&&String(e).trim().toLowerCase()}function Pne(e){return!1===e||null==e?e:mte.isArray(e)?e.map(Pne):String(e)}function Fne(e,t,n,r,a){return mte.isFunction(r)?r.call(this,t,n):(a&&(t=n),mte.isString(t)?mte.isString(r)?-1!==t.indexOf(r):mte.isRegExp(r)?r.test(t):void 0:void 0)}class Ine{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function a(e,t,n){const a=Dne(t);if(!a)throw new Error("header name must be a non-empty string");const o=mte.findKey(r,a);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=Pne(e))}const o=(e,t)=>mte.forEach(e,((e,n)=>a(e,n,t)));if(mte.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(mte.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,a;return e&&e.split("\n").forEach((function(e){a=e.indexOf(":"),n=e.substring(0,a).trim().toLowerCase(),r=e.substring(a+1).trim(),!n||t[n]&&Nne[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if(mte.isHeaders(e))for(const[t,r]of e.entries())a(r,t,n);else null!=e&&a(t,e,n);return this}get(e,t){if(e=Dne(e)){const n=mte.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(mte.isFunction(t))return t.call(this,e,n);if(mte.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Dne(e)){const n=mte.findKey(this,e);return!(!n||void 0===this[n]||t&&!Fne(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function a(e){if(e=Dne(e)){const a=mte.findKey(n,e);!a||t&&!Fne(0,n[a],a,t)||(delete n[a],r=!0)}}return mte.isArray(e)?e.forEach(a):a(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const a=t[n];e&&!Fne(0,this[a],a,e,!0)||(delete this[a],r=!0)}return r}normalize(e){const t=this,n={};return mte.forEach(this,((r,a)=>{const o=mte.findKey(n,a);if(o)return t[o]=Pne(r),void delete t[a];const c=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(a):String(a).trim();c!==a&&delete t[a],t[c]=Pne(r),n[c]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return mte.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&mte.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[_ne]=this[_ne]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Dne(e);t[r]||(function(e,t){const n=mte.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,a){return this[r].call(this,t,e,n,a)},configurable:!0})}))}(n,e),t[r]=!0)}return mte.isArray(e)?e.forEach(r):r(e),this}}function Bne(e,t){const n=this||Rne,r=t||n,a=Ine.from(r.headers);let o=r.data;return mte.forEach(e,(function(e){o=e.call(n,o,a.normalize(),t?t.status:void 0)})),a.normalize(),o}function jne(e){return!(!e||!e.__CANCEL__)}function Une(e,t,n){dne.call(this,null==e?"canceled":e,dne.ERR_CANCELED,t,n),this.name="CanceledError"}function Wne(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new dne("Request failed with status code "+n.status,[dne.ERR_BAD_REQUEST,dne.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Ine.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),mte.reduceDescriptors(Ine.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),mte.freezeMethods(Ine),mte.inherits(Une,dne,{__CANCEL__:!0});const $ne=(e,t,n=3)=>{let r=0;const a=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a,o=0,c=0;return t=void 0!==t?t:1e3,function(i){const l=Date.now(),s=r[c];a||(a=l),n[o]=i,r[o]=l;let h=c,d=0;for(;h!==o;)d+=n[h++],h%=e;if(o=(o+1)%e,o===c&&(c=(c+1)%e),l-a<t)return;const u=s&&l-s;return u?Math.round(1e3*d/u):void 0}}(50,250);return function(e,t){let n,r,a=0,o=1e3/t;const c=(t,o=Date.now())=>{a=o,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),i=t-a;i>=o?c(e,t):(n=e,r||(r=setTimeout((()=>{r=null,c(n)}),o-i)))},()=>n&&c(n)]}((n=>{const o=n.loaded,c=n.lengthComputable?n.total:void 0,i=o-r,l=a(i);r=o,e({loaded:o,total:c,progress:c?o/c:void 0,bytes:i,rate:l||void 0,estimated:l&&c&&o<=c?(c-o)/l:void 0,event:n,lengthComputable:null!=c,[t?"download":"upload"]:!0})}),n)},qne=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Gne=e=>(...t)=>mte.asap((()=>e(...t)));var Yne=One.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,One.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(One.origin),One.navigator&&/(msie|trident)/i.test(One.navigator.userAgent)):()=>!0,Kne=One.hasStandardBrowserEnv?{write(e,t,n,r,a,o){const c=[e+"="+encodeURIComponent(t)];mte.isNumber(n)&&c.push("expires="+new Date(n).toGMTString()),mte.isString(r)&&c.push("path="+r),mte.isString(a)&&c.push("domain="+a),!0===o&&c.push("secure"),document.cookie=c.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Xne(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Qne=e=>e instanceof Ine?{...e}:e;function Jne(e,t){t=t||{};const n={};function r(e,t,n,r){return mte.isPlainObject(e)&&mte.isPlainObject(t)?mte.merge.call({caseless:r},e,t):mte.isPlainObject(t)?mte.merge({},t):mte.isArray(t)?t.slice():t}function a(e,t,n,a){return mte.isUndefined(t)?mte.isUndefined(e)?void 0:r(void 0,e,0,a):r(e,t,0,a)}function o(e,t){if(!mte.isUndefined(t))return r(void 0,t)}function c(e,t){return mte.isUndefined(t)?mte.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function i(n,a,o){return o in t?r(n,a):o in e?r(void 0,n):void 0}const l={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:i,headers:(e,t,n)=>a(Qne(e),Qne(t),0,!0)};return mte.forEach(Object.keys(Object.assign({},e,t)),(function(r){const o=l[r]||a,c=o(e[r],t[r],r);mte.isUndefined(c)&&o!==i||(n[r]=c)})),n}var Zne=e=>{const t=Jne({},e);let n,{data:r,withXSRFToken:a,xsrfHeaderName:o,xsrfCookieName:c,headers:i,auth:l}=t;if(t.headers=i=Ine.from(i),t.url=Hne(Xne(t.baseURL,t.url),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),mte.isFormData(r))if(One.hasStandardBrowserEnv||One.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(!1!==(n=i.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}if(One.hasStandardBrowserEnv&&(a&&mte.isFunction(a)&&(a=a(t)),a||!1!==a&&Yne(t.url))){const e=o&&c&&Kne.read(c);e&&i.set(o,e)}return t},ere="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=Zne(e);let a=r.data;const o=Ine.from(r.headers).normalize();let c,i,l,s,h,{responseType:d,onUploadProgress:u,onDownloadProgress:m}=r;function p(){s&&s(),h&&h(),r.cancelToken&&r.cancelToken.unsubscribe(c),r.signal&&r.signal.removeEventListener("abort",c)}let v=new XMLHttpRequest;function f(){if(!v)return;const r=Ine.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders());Wne((function(e){t(e),p()}),(function(e){n(e),p()}),{data:d&&"text"!==d&&"json"!==d?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:r,config:e,request:v}),v=null}v.open(r.method.toUpperCase(),r.url,!0),v.timeout=r.timeout,"onloadend"in v?v.onloadend=f:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(f)},v.onabort=function(){v&&(n(new dne("Request aborted",dne.ECONNABORTED,e,v)),v=null)},v.onerror=function(){n(new dne("Network Error",dne.ERR_NETWORK,e,v)),v=null},v.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const a=r.transitional||Cne;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new dne(t,a.clarifyTimeoutError?dne.ETIMEDOUT:dne.ECONNABORTED,e,v)),v=null},void 0===a&&o.setContentType(null),"setRequestHeader"in v&&mte.forEach(o.toJSON(),(function(e,t){v.setRequestHeader(t,e)})),mte.isUndefined(r.withCredentials)||(v.withCredentials=!!r.withCredentials),d&&"json"!==d&&(v.responseType=r.responseType),m&&([l,h]=$ne(m,!0),v.addEventListener("progress",l)),u&&v.upload&&([i,s]=$ne(u),v.upload.addEventListener("progress",i),v.upload.addEventListener("loadend",s)),(r.cancelToken||r.signal)&&(c=t=>{v&&(n(!t||t.type?new Une(null,e,v):t),v.abort(),v=null)},r.cancelToken&&r.cancelToken.subscribe(c),r.signal&&(r.signal.aborted?c():r.signal.addEventListener("abort",c)));const z=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);z&&-1===One.protocols.indexOf(z)?n(new dne("Unsupported protocol "+z+":",dne.ERR_BAD_REQUEST,e)):v.send(a||null)}))};const tre=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const a=function(e){if(!n){n=!0,c();const t=e instanceof Error?e:this.reason;r.abort(t instanceof dne?t:new Une(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,a(new dne(`timeout ${t} of ms exceeded`,dne.ETIMEDOUT))}),t);const c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)})),e=null)};e.forEach((e=>e.addEventListener("abort",a)));const{signal:i}=r;return i.unsubscribe=()=>mte.asap(c),i}},nre=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,a=0;for(;a<n;)r=a+t,yield e.slice(a,r),a=r},rre=(e,t,n,r)=>{const a=async function*(e,t){for await(const n of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}}(e))yield*nre(n,t)}(e,t);let o,c=0,i=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await a.next();if(t)return i(),void e.close();let o=r.byteLength;if(n){let e=c+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw i(e),e}},cancel:e=>(i(e),a.return())},{highWaterMark:2})},are="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ore=are&&"function"==typeof ReadableStream,cre=are&&("function"==typeof TextEncoder?(ire=new TextEncoder,e=>ire.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var ire;const lre=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},sre=ore&&lre((()=>{let e=!1;const t=new Request(One.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),hre=ore&&lre((()=>mte.isReadableStream(new Response("").body))),dre={stream:hre&&(e=>e.body)};var ure;are&&(ure=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!dre[e]&&(dre[e]=mte.isFunction(ure[e])?t=>t[e]():(t,n)=>{throw new dne(`Response type '${e}' is not supported`,dne.ERR_NOT_SUPPORT,n)})})));var mre=are&&(async e=>{let{url:t,method:n,data:r,signal:a,cancelToken:o,timeout:c,onDownloadProgress:i,onUploadProgress:l,responseType:s,headers:h,withCredentials:d="same-origin",fetchOptions:u}=Zne(e);s=s?(s+"").toLowerCase():"text";let m,p=tre([a,o&&o.toAbortSignal()],c);const v=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let f;try{if(l&&sre&&"get"!==n&&"head"!==n&&0!==(f=await(async(e,t)=>{const n=mte.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(mte.isBlob(e))return e.size;if(mte.isSpecCompliantForm(e)){const t=new Request(One.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return mte.isArrayBufferView(e)||mte.isArrayBuffer(e)?e.byteLength:(mte.isURLSearchParams(e)&&(e+=""),mte.isString(e)?(await cre(e)).byteLength:void 0)})(t):n})(h,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(mte.isFormData(r)&&(e=n.headers.get("content-type"))&&h.setContentType(e),n.body){const[e,t]=qne(f,$ne(Gne(l)));r=rre(n.body,65536,e,t)}}mte.isString(d)||(d=d?"include":"omit");const a="credentials"in Request.prototype;m=new Request(t,{...u,signal:p,method:n.toUpperCase(),headers:h.normalize().toJSON(),body:r,duplex:"half",credentials:a?d:void 0});let o=await fetch(m);const c=hre&&("stream"===s||"response"===s);if(hre&&(i||c&&v)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=mte.toFiniteNumber(o.headers.get("content-length")),[n,r]=i&&qne(t,$ne(Gne(i),!0))||[];o=new Response(rre(o.body,65536,n,(()=>{r&&r(),v&&v()})),e)}s=s||"text";let z=await dre[mte.findKey(dre,s)||"text"](o,e);return!c&&v&&v(),await new Promise(((t,n)=>{Wne(t,n,{data:z,headers:Ine.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:m})}))}catch(t){if(v&&v(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new dne("Network Error",dne.ERR_NETWORK,e,m),{cause:t.cause||t});throw dne.from(t,t&&t.code,e,m)}});const pre={http:null,xhr:ere,fetch:mre};mte.forEach(pre,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const vre=e=>`- ${e}`,fre=e=>mte.isFunction(e)||null===e||!1===e;var zre=e=>{e=mte.isArray(e)?e:[e];const{length:t}=e;let n,r;const a={};for(let o=0;o<t;o++){let t;if(n=e[o],r=n,!fre(n)&&(r=pre[(t=String(n)).toLowerCase()],void 0===r))throw new dne(`Unknown adapter '${t}'`);if(r)break;a[t||"#"+o]=r}if(!r){const e=Object.entries(a).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new dne("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(vre).join("\n"):" "+vre(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function gre(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Une(null,e)}function yre(e){return gre(e),e.headers=Ine.from(e.headers),e.data=Bne.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),zre(e.adapter||Rne.adapter)(e).then((function(t){return gre(e),t.data=Bne.call(e,e.transformResponse,t),t.headers=Ine.from(t.headers),t}),(function(t){return jne(t)||(gre(e),t&&t.response&&(t.response.data=Bne.call(e,e.transformResponse,t.response),t.response.headers=Ine.from(t.response.headers))),Promise.reject(t)}))}const Mre={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Mre[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const Ere={};Mre.transitional=function(e,t,n){function r(e,t){return"[Axios v1.7.9] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,a,o)=>{if(!1===e)throw new dne(r(a," has been removed"+(t?" in "+t:"")),dne.ERR_DEPRECATED);return t&&!Ere[a]&&(Ere[a]=!0,console.warn(r(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,a,o)}},Mre.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var bre={assertOptions:function(e,t,n){if("object"!=typeof e)throw new dne("options must be an object",dne.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const o=r[a],c=t[o];if(c){const t=e[o],n=void 0===t||c(t,o,e);if(!0!==n)throw new dne("option "+o+" must be "+n,dne.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new dne("Unknown option "+o,dne.ERR_BAD_OPTION)}},validators:Mre};const Hre=bre.validators;class Vre{constructor(e){this.defaults=e,this.interceptors={request:new Vne,response:new Vne}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Jne(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:a}=t;void 0!==n&&bre.assertOptions(n,{silentJSONParsing:Hre.transitional(Hre.boolean),forcedJSONParsing:Hre.transitional(Hre.boolean),clarifyTimeoutError:Hre.transitional(Hre.boolean)},!1),null!=r&&(mte.isFunction(r)?t.paramsSerializer={serialize:r}:bre.assertOptions(r,{encode:Hre.function,serialize:Hre.function},!0)),bre.assertOptions(t,{baseUrl:Hre.spelling("baseURL"),withXsrfToken:Hre.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&mte.merge(a.common,a[t.method]);a&&mte.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete a[e]})),t.headers=Ine.concat(o,a);const c=[];let i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,c.unshift(e.fulfilled,e.rejected))}));const l=[];let s;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let h,d=0;if(!i){const e=[yre.bind(this),void 0];for(e.unshift.apply(e,c),e.push.apply(e,l),h=e.length,s=Promise.resolve(t);d<h;)s=s.then(e[d++],e[d++]);return s}h=c.length;let u=t;for(d=0;d<h;){const t=c[d++],n=c[d++];try{u=t(u)}catch(e){n.call(this,e);break}}try{s=yre.call(this,u)}catch(e){return Promise.reject(e)}for(d=0,h=l.length;d<h;)s=s.then(l[d++],l[d++]);return s}getUri(e){return Hne(Xne((e=Jne(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}mte.forEach(["delete","get","head","options"],(function(e){Vre.prototype[e]=function(t,n){return this.request(Jne(n||{},{method:e,url:t,data:(n||{}).data}))}})),mte.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,a){return this.request(Jne(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Vre.prototype[e]=t(),Vre.prototype[e+"Form"]=t(!0)}));class Cre{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,a){n.reason||(n.reason=new Une(e,r,a),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Cre((function(t){e=t})),cancel:e}}}const Lre={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Lre).forEach((([e,t])=>{Lre[t]=e}));const kre=function e(t){const n=new Vre(t),r=Hee(Vre.prototype.request,n);return mte.extend(r,Vre.prototype,n,{allOwnKeys:!0}),mte.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Jne(t,n))},r}(Rne);kre.Axios=Vre,kre.CanceledError=Une,kre.CancelToken=Cre,kre.isCancel=jne,kre.VERSION="1.7.9",kre.toFormData=gne,kre.AxiosError=dne,kre.Cancel=kre.CanceledError,kre.all=function(e){return Promise.all(e)},kre.spread=function(e){return function(t){return e.apply(null,t)}},kre.isAxiosError=function(e){return mte.isObject(e)&&!0===e.isAxiosError},kre.mergeConfig=Jne,kre.AxiosHeaders=Ine,kre.formToJSON=e=>Ane(mte.isHTMLForm(e)?new FormData(e):e),kre.getAdapter=zre,kre.HttpStatusCode=Lre,kre.default=kre;var wre=function(){function e(){}return e.convertJsonToQueryParamsString=function(e){return Object.keys(e).map((function(t){return t+"="+e[t]})).join("&")},e}(),Sre=function(){function e(e){var t=this;this._backendBaseUrl="",this.updatePdf=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.put("".concat(this.getPdfApisEndPointRoute()),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchOnlyPdfData=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfApisEndPointRoute(),"/get"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchOnlyPdfPagesData=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfPagesApisEndPointRoute(),"?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.createCommentThread=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfApisEndPointRoute(),"/commentThreads"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.deleteCommentThread=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfApisEndPointRoute(),"/commentThreads/delete"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.getCommentThreadById=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfApisEndPointRoute(),"/commentThreads/").concat(e.commentThreadId))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchCommentThreads=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfApisEndPointRoute(),"/commentThreads?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.createComment=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfApisEndPointRoute(),"/commentThreads/comments"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchUsersOfPdf=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfApisEndPointRoute(),"/getUsers?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.createPageAnnotation=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:if(Object.keys(e.annotation||{}).length>1)throw new Error("invalid request payload");return[4,null===(n=this.api)||void 0===n?void 0:n.post(this.getPdfPagesAnnotationApisEndPointRoute(),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchAnnotation=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfPagesAnnotationApisEndPointRoute(),"?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchAllAnnotationsOfThePage=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.get("".concat(this.getPdfPagesAnnotationApisEndPointRoute(),"?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.updatePageAnnotation=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.put(this.getPdfPagesAnnotationApisEndPointRoute(),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.deletePageAnnotation=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.delete("".concat(this.getPdfPagesAnnotationApisEndPointRoute(),"?").concat(wre.convertJsonToQueryParamsString(e)))];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.fetchPdfScales=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfScalesApisEndPointRoute(),"/get"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.createPdfScale=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.post("".concat(this.getPdfScalesApisEndPointRoute()),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.deletePdfScale=function(e){return K7(t,void 0,void 0,(function(){var t;return X7(this,(function(n){switch(n.label){case 0:return[4,null===(t=this.api)||void 0===t?void 0:t.post("".concat(this.getPdfScalesApisEndPointRoute(),"/delete"),e)];case 1:return n.sent(),[2]}}))}))},this.updatePdfScale=function(e){return K7(t,void 0,void 0,(function(){var t,n;return X7(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.api)||void 0===n?void 0:n.put("".concat(this.getPdfScalesApisEndPointRoute(),"/update"),e)];case 1:return[2,null==(t=r.sent())?void 0:t.data]}}))}))},this.convertImageToPdf=function(e){var n=e.imageDownloadUrl,r=e.imageWidth,a=e.imageHeight;return K7(t,void 0,void 0,(function(){var e,t,o,c,i;return X7(this,(function(l){switch(l.label){case 0:return e={pdfFileName:"image.pdf",imageDetails:{imageDownloadUrl:n,imageWidth:r,imageHeight:a}},[4,null===(o=this.api)||void 0===o?void 0:o.post("".concat(this.getPdfApisEndPointRoute()),e)];case 1:if(t=l.sent(),!(null===(c=null==t?void 0:t.data)||void 0===c?void 0:c._id))throw new Error("pdfId not found");return[4,null===(i=this.api)||void 0===i?void 0:i.post("".concat(this.getPdfApisEndPointRoute(),"/pdf-pages-as-images"),{pdfId:null==t?void 0:t.data._id})];case 2:return l.sent(),[2,{_id:null==t?void 0:t.data._id}]}}))}))},this.backendBaseUrl=e.backendBaseUrl,this.api=kre.create({baseURL:this.backendBaseUrl,headers:{"Content-type":"application/json; charset=utf-8"},withCredentials:!0})}return Object.defineProperty(e.prototype,"backendBaseUrl",{get:function(){return this._backendBaseUrl},set:function(e){this._backendBaseUrl=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"api",{get:function(){return this._api},set:function(e){this._api=e},enumerable:!1,configurable:!0}),e.prototype.getPdfApisEndPointRoute=function(){return"".concat(this.backendBaseUrl,"/pdfs")},e.prototype.getPdfPagesApisEndPointRoute=function(){return"".concat(this.getPdfApisEndPointRoute(),"/pages")},e.prototype.getPdfScalesApisEndPointRoute=function(){return"".concat(this.getPdfApisEndPointRoute(),"/scales")},e.prototype.getPdfPagesAnnotationApisEndPointRoute=function(){return"".concat(this.getPdfPagesApisEndPointRoute(),"/annotation")},e.calculateDistanceBetweenTwoCoordinatesInPdfPagePoints=function(e){var t=e.normalisedCoordinates2.x-e.normalisedCoordinates1.x,n=e.normalisedCoordinates2.y-e.normalisedCoordinates1.y;return Math.sqrt(t*t+n*n)/(e.pdfPageImageOriginalWidth/e.pdfPageOriginalWidthInPoints)},e.convertPdfPagePointsDistanceToInches=function(e){return e.pdfPagePointsDistance/72},e.convertInchesToCentimeters=function(e){return 2.54*e.inches},e.convertInchesToMeters=function(e){return e.inches/39.37},e.convertInchesToFeet=function(e){return e.inches/12},e.convertInchesDistanceToPdfPagePoints=function(e){return 72*e.inchesDistance},e.isUserMoreNearToHorizontalAxisOrVerticalAxis=function(e){var t=e.firstCoordinate,n=e.secondCoordinate,r=n.x-t.x,a=n.y-t.y;return Math.abs(r)>Math.abs(a)?"horizontal":"vertical"},e.prototype.insertPdfAndItsPagesInDb=function(e){var t,n,r;return K7(this,void 0,void 0,(function(){var a,o,c;return X7(this,(function(i){switch(i.label){case 0:return(a=new FormData).append("pdfDownloadUrl",e.pdfSourceUrl),e.pdfFileName&&a.append("pdfFileName",e.pdfFileName),[4,null===(t=this.api)||void 0===t?void 0:t.post("".concat(this.getPdfApisEndPointRoute()),a,{headers:{"Content-Type":"multipart/form-data"}})];case 1:if(o=i.sent(),!(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n._id))throw new Error("pdfId not found");return c=null===(r=this.api)||void 0===r?void 0:r.post("".concat(this.getPdfApisEndPointRoute(),"/pdf-pages-as-images"),{pdfId:null==o?void 0:o.data._id}),e.shouldWaitForPdfPagesCreation?[4,c]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2,{_id:null==o?void 0:o.data._id}]}}))}))},e.convertNormalisedCoordinatesToUnNormalisedCoordinates=function(t){for(var n=t.normalisedCoordinates,r=t.normalisedXDimension,a=t.normalisedYDimension,o=t.unNormalisedXDimension,c=t.unNormalisedYDimension,i=[],l=0,s=n;l<s.length;l++){var h=s[l],d=h.x,u=h.y,m=e.convertNormalisedValueToUnNormalisedForShowingInUI({normalisedValue:d,normalisedDimension:r,unNormalisedDimension:o}),p=e.convertNormalisedValueToUnNormalisedForShowingInUI({normalisedValue:u,normalisedDimension:a,unNormalisedDimension:c});i.push({x:m,y:p})}return i},e.doNotMakeCoordinatesGoOutOfBoundary=function(e){for(var t=e.coordinates,n=e.coordinateBoundaries,r=0,a=t;r<a.length;r++){var o=a[r];o.x<n.xMin?o.x=n.xMin:o.x>n.xMax&&(o.x=n.xMax),o.y<n.yMin?o.y=n.yMin:o.y>n.yMax&&(o.y=n.yMax)}return t},e.prototype.insertPdfAndItsPagesInDBViaHTML=function(e){var t,n,r;return K7(this,void 0,void 0,(function(){var a,o,c,i,l,s,h;return X7(this,(function(d){switch(d.label){case 0:if(!(a=document.getElementById(e.htmlElementId)))throw new Error("htmlELement corresponding to the id not found");return o=a.outerHTML,e.cssClassNamesWhichShouldBeRemovedBeforeHtmlToPdfConversion.forEach((function(e){o=o.replaceAll(e,"")})),c=Array.from(document.querySelectorAll("style")).map((function(e){return e.outerHTML})).join("\n"),i='\n <html>\n <head>\n <meta charset="UTF-8">\n '.concat(c,"\n </head>\n <body>\n ").concat(o,"\n </body>\n </html>\n "),l={pdfFileName:"react-html.pdf",htmlDocument:{document:i,width:a.clientWidth}},[4,null===(t=this.api)||void 0===t?void 0:t.post("".concat(this.getPdfApisEndPointRoute()),l)];case 1:if(s=d.sent(),!(null===(n=null==s?void 0:s.data)||void 0===n?void 0:n._id))throw new Error("pdfId not found");return h=null===(r=this.api)||void 0===r?void 0:r.post("".concat(this.getPdfApisEndPointRoute(),"/pdf-pages-as-images"),{pdfId:null==s?void 0:s.data._id}),e.shouldWaitForPdfPagesCreation?[4,h]:[3,3];case 2:d.sent(),d.label=3;case 3:return[2,{_id:null==s?void 0:s.data._id}]}}))}))},e.convertValueFromOneUnitToAnotherUnit=function(e){var t=e.valueToConvert,n=e.fromUnit,r=e.toUnit;if(n===r)return t;var a=0;if("cm"===n)if("m"===r)a=t/100;else if("inch"===r)a=t/2.54;else{if("ft"!==r)throw new Error("Invalid toUnit");a=t/30.48}else if("m"===n)if("cm"===r)a=100*t;else if("inch"===r)a=39.37*t;else{if("ft"!==r)throw new Error("Invalid toUnit");a=3.281*t}else if("inch"===n)if("cm"===r)a=2.54*t;else if("m"===r)a=t/39.37;else{if("ft"!==r)throw new Error("Invalid toUnit");a=t/12}else{if("ft"!==n)throw new Error("Invalid fromUnit");if("cm"===r)a=30.48*t;else if("m"===r)a=t/3.281;else{if("inch"!==r)throw new Error("Invalid toUnit");a=12*t}}return a},e.convertNormalisedValueToUnNormalisedForShowingInUI=function(e){var t=e.normalisedValue,n=e.normalisedDimension;return t*(e.unNormalisedDimension/n)},e.convertUnNormalisedValueToNormalised=function(e){var t=e.unNormalisedValue,n=e.normalisedDimension;return t/(e.unNormalisedDimension/n)},e.convertCoordinatesArrayToNumberArray=function(e){for(var t=e.coordinates,n=[],r=0;r<t.length;r++)n.push(t[r].x),n.push(t[r].y);return n},e}(),xre=function(){function e(){}return e.getImageWidthHeightFromURL=function(e){return K7(this,void 0,void 0,(function(){var t;return X7(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,new Promise((function(t,n){try{var r=new Image;r.onload=function(){return t({width:r.width,height:r.height})},r.src=e}catch(e){n(new Error(e.message))}}))];case 1:return[2,n.sent()];case 2:throw t=n.sent(),new Error(t.message);case 3:return[2]}}))}))},e.getImageHeight=function(e,t){return e/t},e.getImageWidth=function(e,t){return e*t},e.downloadImage=function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=function(){return n(new Error("Image loading having url ".concat(e," got failed")))},r.src=e}))},e}(),Tre={d:(e,t)=>{for(var n in t)Tre.o(t,n)&&!Tre.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},Ore=globalThis.pdfjsLib={};Tre.d(Ore,{AbortException:()=>cae,AnnotationEditorLayer:()=>Pie,AnnotationEditorParamsType:()=>Fre,AnnotationEditorType:()=>Pre,AnnotationEditorUIManager:()=>$ae,AnnotationLayer:()=>yie,AnnotationMode:()=>Dre,ColorPicker:()=>Sie,DOMSVGFactory:()=>Bce,DrawLayer:()=>Fie,FeatureTest:()=>hae,GlobalWorkerOptions:()=>Boe,ImageKind:()=>Bre,InvalidPDFException:()=>nae,MissingPDFException:()=>rae,OPS:()=>Ure,OutputScale:()=>_ae,PDFDataRangeTransport:()=>Cce,PDFDateString:()=>xae,PDFWorker:()=>Sce,PasswordResponses:()=>Wre,PermissionFlag:()=>Ire,PixelsPerInch:()=>gae,RenderingCancelledException:()=>Eae,TextLayer:()=>vce,TouchManager:()=>Gae,UnexpectedResponseException:()=>aae,Util:()=>uae,VerbosityLevel:()=>jre,XfaLayer:()=>jce,build:()=>_ce,createValidAbsoluteUrl:()=>Qre,fetchData:()=>yae,getDocument:()=>bce,getFilenameFromUrl:()=>Vae,getPdfFilenameFromUrl:()=>Cae,getXfaPageViewport:()=>Tae,isDataScheme:()=>bae,isPdfFile:()=>Hae,noContextMenu:()=>wae,normalizeUnicode:()=>vae,setLayerDimensions:()=>Nae,shadow:()=>Jre,stopEvent:()=>Sae,version:()=>Nce});const Are=!("object"!=typeof St||St+""!="[object process]"||St.versions.nw||St.versions.electron&&St.type&&"browser"!==St.type),Rre=[1,0,0,1,0,0],Nre=[.001,0,0,.001,0,0],_re=1.35,Dre={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Pre={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Fre={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},Ire={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Bre={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},jre={ERRORS:0,WARNINGS:1,INFOS:5},Ure={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},Wre={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let $re=jre.WARNINGS;function qre(){return $re}function Gre(e){$re>=jre.INFOS&&console.log(`Info: ${e}`)}function Yre(e){$re>=jre.WARNINGS&&console.log(`Warning: ${e}`)}function Kre(e){throw new Error(e)}function Xre(e,t){e||Kre(t)}function Qre(e,t=null,n=null){if(!e)return null;try{if(n&&"string"==typeof e){if(n.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(n.tryConvertEncoding)try{e=decodeURIComponent(escape(e))}catch{}}const r=t?new URL(e,t):new URL(e);if(function(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch{}return null}function Jre(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}const Zre=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=new Error,e.constructor=e,e}();class eae extends Zre{constructor(e,t){super(e,"PasswordException"),this.code=t}}class tae extends Zre{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class nae extends Zre{constructor(e){super(e,"InvalidPDFException")}}class rae extends Zre{constructor(e){super(e,"MissingPDFException")}}class aae extends Zre{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class oae extends Zre{constructor(e){super(e,"FormatError")}}class cae extends Zre{constructor(e){super(e,"AbortException")}}function iae(e){"object"==typeof e&&void 0!==e?.length||Kre("Invalid argument for bytesToString");const t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);const r=[];for(let a=0;a<t;a+=n){const o=Math.min(a+n,t),c=e.subarray(a,o);r.push(String.fromCharCode.apply(null,c))}return r.join("")}function lae(e){"string"!=typeof e&&Kre("Invalid argument for stringToBytes");const t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=255&e.charCodeAt(r);return n}function sae(e){const t=Object.create(null);for(const[n,r]of e)t[n]=r;return t}class hae{static get isLittleEndian(){return Jre(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return Jre(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return Jre(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return Jre(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?Jre(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):Jre(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return Jre(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const dae=Array.from(Array(256).keys(),(e=>e.toString(16).padStart(2,"0")));class uae{static makeHexColor(e,t,n){return`#${dae[e]}${dae[t]}${dae[n]}`}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[1],t[1]=n,n=t[2],t[2]=t[3],t[3]=n,e[1]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){const n=this.applyTransform(e,t),r=this.applyTransform(e.slice(2,4),t),a=this.applyTransform([e[0],e[3]],t),o=this.applyTransform([e[2],e[1]],t);return[Math.min(n[0],r[0],a[0],o[0]),Math.min(n[1],r[1],a[1],o[1]),Math.max(n[0],r[0],a[0],o[0]),Math.max(n[1],r[1],a[1],o[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],a=e[2]*t[0]+e[3]*t[2],o=e[2]*t[1]+e[3]*t[3],c=(n+o)/2,i=Math.sqrt((n+o)**2-4*(n*o-a*r))/2,l=c+i||1,s=c-i||1;return[Math.sqrt(l),Math.sqrt(s)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;const a=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),o=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return a>o?null:[n,a,r,o]}static#e(e,t,n,r,a,o,c,i,l,s){if(l<=0||l>=1)return;const h=1-l,d=l*l,u=d*l,m=h*(h*(h*e+3*l*t)+3*d*n)+u*r,p=h*(h*(h*a+3*l*o)+3*d*c)+u*i;s[0]=Math.min(s[0],m),s[1]=Math.min(s[1],p),s[2]=Math.max(s[2],m),s[3]=Math.max(s[3],p)}static#t(e,t,n,r,a,o,c,i,l,s,h,d){if(Math.abs(l)<1e-12)return void(Math.abs(s)>=1e-12&&this.#e(e,t,n,r,a,o,c,i,-h/s,d));const u=s**2-4*h*l;if(u<0)return;const m=Math.sqrt(u),p=2*l;this.#e(e,t,n,r,a,o,c,i,(-s+m)/p,d),this.#e(e,t,n,r,a,o,c,i,(-s-m)/p,d)}static bezierBoundingBox(e,t,n,r,a,o,c,i,l){return l?(l[0]=Math.min(l[0],e,c),l[1]=Math.min(l[1],t,i),l[2]=Math.max(l[2],e,c),l[3]=Math.max(l[3],t,i)):l=[Math.min(e,c),Math.min(t,i),Math.max(e,c),Math.max(t,i)],this.#t(e,n,a,c,t,r,o,i,3*(3*(n-a)-e+c),6*(e-2*n+a),3*(n-e),l),this.#t(e,n,a,c,t,r,o,i,3*(3*(r-o)-t+i),6*(t-2*r+o),3*(r-t),l),l}}let mae=null,pae=null;function vae(e){return mae||(mae=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,pae=new Map([["ſt","ſt"]])),e.replaceAll(mae,((e,t,n)=>t?t.normalize("NFKC"):pae.get(n)))}const fae="pdfjs_internal_id_";"function"!=typeof Promise.try&&(Promise.try=function(e,...t){return new Promise((n=>{n(e(...t))}))});const zae="http://www.w3.org/2000/svg";class gae{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function yae(e,t="text"){if(kae(e,document.baseURI)){const n=await fetch(e);if(!n.ok)throw new Error(n.statusText);switch(t){case"arraybuffer":return n.arrayBuffer();case"blob":return n.blob();case"json":return n.json()}return n.text()}return new Promise(((n,r)=>{const a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType=t,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE)if(200!==a.status&&0!==a.status)r(new Error(a.statusText));else{switch(t){case"arraybuffer":case"blob":case"json":return void n(a.response)}n(a.responseText)}},a.send(null)}))}class Mae{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:a=0,offsetY:o=0,dontFlip:c=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=a,this.offsetY=o,n*=t;const i=(e[2]+e[0])/2,l=(e[3]+e[1])/2;let s,h,d,u,m,p,v,f;switch((r%=360)<0&&(r+=360),r){case 180:s=-1,h=0,d=0,u=1;break;case 90:s=0,h=1,d=1,u=0;break;case 270:s=0,h=-1,d=-1,u=0;break;case 0:s=1,h=0,d=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}c&&(d=-d,u=-u),0===s?(m=Math.abs(l-e[1])*n+a,p=Math.abs(i-e[0])*n+o,v=(e[3]-e[1])*n,f=(e[2]-e[0])*n):(m=Math.abs(i-e[0])*n+a,p=Math.abs(l-e[1])*n+o,v=(e[2]-e[0])*n,f=(e[3]-e[1])*n),this.transform=[s*n,h*n,d*n,u*n,m-s*n*i-d*n*l,p-h*n*i-u*n*l],this.width=v,this.height=f}get rawDims(){const{userUnit:e,viewBox:t}=this,n=t.map((t=>t*e));return Jre(this,"rawDims",{pageWidth:n[2]-n[0],pageHeight:n[3]-n[1],pageX:n[0],pageY:n[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:r=this.offsetY,dontFlip:a=!1}={}){return new Mae({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:a})}convertToViewportPoint(e,t){return uae.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=uae.applyTransform([e[0],e[1]],this.transform),n=uae.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){return uae.applyInverseTransform([e,t],this.transform)}}class Eae extends Zre{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function bae(e){const t=e.length;let n=0;for(;n<t&&""===e[n].trim();)n++;return"data:"===e.substring(n,n+5).toLowerCase()}function Hae(e){return"string"==typeof e&&/\.pdf$/i.test(e)}function Vae(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function Cae(e,t="document.pdf"){if("string"!=typeof e)return t;if(bae(e))return Yre('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,r=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let a=n.exec(r[1])||n.exec(r[2])||n.exec(r[3]);if(a&&(a=a[0],a.includes("%")))try{a=n.exec(decodeURIComponent(a))[0]}catch{}return a||t}class Lae{started=Object.create(null);times=[];time(e){e in this.started&&Yre(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Yre(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:e}of this.times)t=Math.max(e.length,t);for(const{name:n,start:r,end:a}of this.times)e.push(`${n.padEnd(t)} ${a-r}ms\n`);return e.join("")}}function kae(e,t){try{const{protocol:n}=t?new URL(e,t):new URL(e);return"http:"===n||"https:"===n}catch{return!1}}function wae(e){e.preventDefault()}function Sae(e){e.preventDefault(),e.stopPropagation()}class xae{static#n;static toDateObject(e){if(!e||"string"!=typeof e)return null;this.#n||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const t=this.#n.exec(e);if(!t)return null;const n=parseInt(t[1],10);let r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let a=parseInt(t[3],10);a=a>=1&&a<=31?a:1;let o=parseInt(t[4],10);o=o>=0&&o<=23?o:0;let c=parseInt(t[5],10);c=c>=0&&c<=59?c:0;let i=parseInt(t[6],10);i=i>=0&&i<=59?i:0;const l=t[7]||"Z";let s=parseInt(t[8],10);s=s>=0&&s<=23?s:0;let h=parseInt(t[9],10)||0;return h=h>=0&&h<=59?h:0,"-"===l?(o+=s,c+=h):"+"===l&&(o-=s,c-=h),new Date(Date.UTC(n,r,a,o,c,i))}}function Tae(e,{scale:t=1,rotation:n=0}){const{width:r,height:a}=e.attributes.style,o=[0,0,parseInt(r),parseInt(a)];return new Mae({viewBox:o,userUnit:1,scale:t,rotation:n})}function Oae(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):(Yre(`Not a valid color format: "${e}"`),[0,0,0])}function Aae(e){const{a:t,b:n,c:r,d:a,e:o,f:c}=e.getTransform();return[t,n,r,a,o,c]}function Rae(e){const{a:t,b:n,c:r,d:a,e:o,f:c}=e.getTransform().invertSelf();return[t,n,r,a,o,c]}function Nae(e,t,n=!1,r=!0){if(t instanceof Mae){const{pageWidth:r,pageHeight:a}=t.rawDims,{style:o}=e,c=hae.isCSSRoundSupported,i=`var(--scale-factor) * ${r}px`,l=`var(--scale-factor) * ${a}px`,s=c?`round(down, ${i}, var(--scale-round-x, 1px))`:`calc(${i})`,h=c?`round(down, ${l}, var(--scale-round-y, 1px))`:`calc(${l})`;n&&t.rotation%180!=0?(o.width=h,o.height=s):(o.width=s,o.height=h)}r&&e.setAttribute("data-main-rotation",t.rotation)}class _ae{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}class Dae{#r=null;#a=null;#o;#c=null;#i=null;static#l=null;constructor(e){this.#o=e,Dae.#l||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"})}render(){const e=this.#r=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=this.#o._uiManager._signal;e.addEventListener("contextmenu",wae,{signal:t}),e.addEventListener("pointerdown",Dae.#s,{signal:t});const n=this.#c=document.createElement("div");n.className="buttons",e.append(n);const r=this.#o.toolbarPosition;if(r){const{style:t}=e,n="ltr"===this.#o._uiManager.direction?1-r[0]:r[0];t.insetInlineEnd=100*n+"%",t.top=`calc(${100*r[1]}% + var(--editor-toolbar-vert-offset))`}return this.#h(),e}get div(){return this.#r}static#s(e){e.stopPropagation()}#d(e){this.#o._focusEventsAllowed=!1,Sae(e)}#u(e){this.#o._focusEventsAllowed=!0,Sae(e)}#m(e){const t=this.#o._uiManager._signal;e.addEventListener("focusin",this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",this.#u.bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",wae,{signal:t})}hide(){this.#r.classList.add("hidden"),this.#a?.hideDropdown()}show(){this.#r.classList.remove("hidden"),this.#i?.shown()}#h(){const{editorType:e,_uiManager:t}=this.#o,n=document.createElement("button");n.className="delete",n.tabIndex=0,n.setAttribute("data-l10n-id",Dae.#l[e]),this.#m(n),n.addEventListener("click",(e=>{t.delete()}),{signal:t._signal}),this.#c.append(n)}get#p(){const e=document.createElement("div");return e.className="divider",e}async addAltText(e){const t=await e.render();this.#m(t),this.#c.prepend(t,this.#p),this.#i=e}addColorPicker(e){this.#a=e;const t=e.renderButton();this.#m(t),this.#c.prepend(t,this.#p)}remove(){this.#r.remove(),this.#a?.destroy(),this.#a=null}}class Pae{#c=null;#r=null;#v;constructor(e){this.#v=e}#f(){const e=this.#r=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",wae,{signal:this.#v._signal});const t=this.#c=document.createElement("div");return t.className="buttons",e.append(t),this.#z(),e}#g(e,t){let n=0,r=0;for(const a of e){const e=a.y+a.height;if(e<n)continue;const o=a.x+(t?a.width:0);e>n?(r=o,n=e):t?o>r&&(r=o):o<r&&(r=o)}return[t?1-r:r,n]}show(e,t,n){const[r,a]=this.#g(t,n),{style:o}=this.#r||=this.#f();e.append(this.#r),o.insetInlineEnd=100*r+"%",o.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){this.#r.remove()}#z(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=this.#v._signal;e.addEventListener("contextmenu",wae,{signal:n}),e.addEventListener("click",(()=>{this.#v.highlightSelection("floating_button")}),{signal:n}),this.#c.append(e)}}function Fae(e,t,n){for(const r of n)t.addEventListener(r,e[r].bind(e))}class Iae{#y=0;get id(){return"pdfjs_internal_editor_"+this.#y++}}class Bae{#M=function(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();const e=new Uint8Array(32);return crypto.getRandomValues(e),iae(e)}();#y=0;#E=null;static get _isSVGFittingCanvas(){const e=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),t=new Image;return t.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',Jre(this,"_isSVGFittingCanvas",t.decode().then((()=>(e.drawImage(t,0,0,1,1,0,0,1,3),0===new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]))))}async#b(e,t){this.#E||=new Map;let n=this.#E.get(e);if(null===n)return null;if(n?.bitmap)return n.refCounter+=1,n;try{let e;if(n||={bitmap:null,id:`image_${this.#M}_${this.#y++}`,refCounter:0,isSvg:!1},"string"==typeof t?(n.url=t,e=await yae(t,"blob")):t instanceof File?e=n.file=t:t instanceof Blob&&(e=t),"image/svg+xml"===e.type){const t=Bae._isSVGFittingCanvas,r=new FileReader,a=new Image,o=new Promise(((e,o)=>{a.onload=()=>{n.bitmap=a,n.isSvg=!0,e()},r.onload=async()=>{const e=n.svgUrl=r.result;a.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},a.onerror=r.onerror=o}));r.readAsDataURL(e),await o}else n.bitmap=await createImageBitmap(e);n.refCounter=1}catch(e){Yre(e),n=null}return this.#E.set(e,n),n&&this.#E.set(n.id,n),n}async getFromFile(e){const{lastModified:t,name:n,size:r,type:a}=e;return this.#b(`${t}_${n}_${r}_${a}`,e)}async getFromUrl(e){return this.#b(e,e)}async getFromBlob(e,t){const n=await t;return this.#b(e,n)}async getFromId(e){this.#E||=new Map;const t=this.#E.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#E||=new Map;let n=this.#E.get(e);if(n?.bitmap)return n.refCounter+=1,n;const r=new OffscreenCanvas(t.width,t.height);return r.getContext("2d").drawImage(t,0,0),n={bitmap:r.transferToImageBitmap(),id:`image_${this.#M}_${this.#y++}`,refCounter:1,isSvg:!1},this.#E.set(e,n),this.#E.set(n.id,n),n}getSvgUrl(e){const t=this.#E.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#E||=new Map;const t=this.#E.get(e);if(!t)return;if(t.refCounter-=1,0!==t.refCounter)return;const{bitmap:n}=t;if(!t.url&&!t.file){const e=new OffscreenCanvas(n.width,n.height);e.getContext("bitmaprenderer").transferFromImageBitmap(n),t.blobPromise=e.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#M}_`)}}class jae{#H=[];#V=!1;#C;#L=-1;constructor(e=128){this.#C=e}add({cmd:e,undo:t,post:n,mustExec:r,type:a=NaN,overwriteIfSameType:o=!1,keepUndo:c=!1}){if(r&&e(),this.#V)return;const i={cmd:e,undo:t,post:n,type:a};if(-1===this.#L)return this.#H.length>0&&(this.#H.length=0),this.#L=0,void this.#H.push(i);if(o&&this.#H[this.#L].type===a)return c&&(i.undo=this.#H[this.#L].undo),void(this.#H[this.#L]=i);const l=this.#L+1;l===this.#C?this.#H.splice(0,1):(this.#L=l,l<this.#H.length&&this.#H.splice(l)),this.#H.push(i)}undo(){if(-1===this.#L)return;this.#V=!0;const{undo:e,post:t}=this.#H[this.#L];e(),t?.(),this.#V=!1,this.#L-=1}redo(){if(this.#L<this.#H.length-1){this.#L+=1,this.#V=!0;const{cmd:e,post:t}=this.#H[this.#L];e(),t?.(),this.#V=!1}}hasSomethingToUndo(){return-1!==this.#L}hasSomethingToRedo(){return this.#L<this.#H.length-1}cleanType(e){if(-1!==this.#L){for(let t=this.#L;t>=0;t--)if(this.#H[t].type!==e)return this.#H.splice(t+1,this.#L-t),void(this.#L=t);this.#H.length=0,this.#L=-1}}destroy(){this.#H=null}}class Uae{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=hae.platform;for(const[n,r,a={}]of e)for(const e of n){const n=e.startsWith("mac+");t&&n?(this.callbacks.set(e.slice(4),{callback:r,options:a}),this.allKeys.add(e.split("+").at(-1))):t||n||(this.callbacks.set(e,{callback:r,options:a}),this.allKeys.add(e.split("+").at(-1)))}}#k(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const n=this.callbacks.get(this.#k(t));if(!n)return;const{callback:r,options:{bubbles:a=!1,args:o=[],checker:c=null}}=n;c&&!c(e,t)||(r.bind(e,...o,t)(),a||Sae(t))}}class Wae{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return function(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const n of e.keys()){t.style.color=n;const r=window.getComputedStyle(t).color;e.set(n,Oae(r))}t.remove()}(e),Jre(this,"_colors",e)}convert(e){const t=Oae(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,n]of this._colors)if(n.every(((e,n)=>e===t[n])))return Wae._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?uae.makeHexColor(...t):e}}class $ae{#w=new AbortController;#S=null;#x=new Map;#T=new Map;#O=null;#A=null;#R=null;#N=new jae;#_=null;#D=null;#P=0;#F=new Set;#I=null;#B=null;#j=new Set;_editorUndoBar=null;#U=!1;#W=!1;#$=!1;#q=null;#G=null;#Y=null;#K=null;#X=!1;#Q=null;#J=new Iae;#Z=!1;#ee=!1;#te=null;#ne=null;#re=null;#ae=null;#oe=Pre.NONE;#ce=new Set;#ie=null;#le=null;#se=null;#he={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#de=[0,0];#ue=null;#me=null;#pe=null;#ve=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=$ae.prototype,t=e=>e.#me.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&e.hasSomethingToControl(),n=(e,{target:t})=>{if(t instanceof HTMLInputElement){const{type:e}=t;return"text"!==e&&"number"!==e}return!0},r=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return Jre(this,"_keyboardManager",new Uae([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#me.contains(t)&&!e.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#me.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-r,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-a,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[r,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[a,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-r],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-a],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,r],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,a],checker:t}]]))}constructor(e,t,n,r,a,o,c,i,l,s,h,d,u){const m=this._signal=this.#w.signal;this.#me=e,this.#pe=t,this.#O=n,this._eventBus=r,r._on("editingaction",this.onEditingAction.bind(this),{signal:m}),r._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),r._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),r._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),r._on("setpreference",this.onSetPreference.bind(this),{signal:m}),r._on("switchannotationeditorparams",(e=>this.updateParams(e.type,e.value)),{signal:m}),this.#fe(),this.#ze(),this.#ge(),this.#A=a.annotationStorage,this.#q=a.filterFactory,this.#le=o,this.#K=c||null,this.#U=i,this.#W=l,this.#$=s,this.#ae=h||null,this.viewParameters={realScale:gae.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=d||null,this._supportsPinchToZoom=!1!==u}destroy(){this.#ve?.resolve(),this.#ve=null,this.#w?.abort(),this.#w=null,this._signal=null;for(const e of this.#T.values())e.destroy();this.#T.clear(),this.#x.clear(),this.#j.clear(),this.#S=null,this.#ce.clear(),this.#N.destroy(),this.#O?.destroy(),this.#Q?.hide(),this.#Q=null,this.#G&&(clearTimeout(this.#G),this.#G=null),this.#ue&&(clearTimeout(this.#ue),this.#ue=null),this._editorUndoBar?.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#ae}get useNewAltTextFlow(){return this.#W}get useNewAltTextWhenAddingImage(){return this.#$}get hcmFilter(){return Jre(this,"hcmFilter",this.#le?this.#q.addHCMFilter(this.#le.foreground,this.#le.background):"none")}get direction(){return Jre(this,"direction",getComputedStyle(this.#me).direction)}get highlightColors(){return Jre(this,"highlightColors",this.#K?new Map(this.#K.split(",").map((e=>e.split("=").map((e=>e.trim()))))):null)}get highlightColorNames(){return Jre(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(e=>e.reverse()))):null)}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#D=e}setMainHighlightColorPicker(e){this.#re=e}editAltText(e,t=!1){this.#O?.editAltText(this,e,t)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){"enableNewAltTextWhenAddingImage"===e&&(this.#$=t)}onPageChanging({pageNumber:e}){this.#P=e-1}focusMainContainer(){this.#me.focus()}findParent(e,t){for(const n of this.#T.values()){const{x:r,y:a,width:o,height:c}=n.div.getBoundingClientRect();if(e>=r&&e<=r+o&&t>=a&&t<=a+c)return n}return null}disableUserSelect(e=!1){this.#pe.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#j.add(e)}removeShouldRescale(e){this.#j.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*gae.PDF_TO_CSS_UNITS;for(const e of this.#j)e.onScaleChanging();this.#D?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#ye({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#Me(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const t of this.#T.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:o}=t,c=t.toString(),i=this.#ye(t).closest(".textLayer"),l=this.getSelectionBoxes(i);if(!l)return;t.empty();const s=this.#Me(i),h=this.#oe===Pre.NONE,d=()=>{s?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:o,text:c}),h&&this.showAllEditors("highlight",!0,!0)};h?this.switchToMode(Pre.HIGHLIGHT,d):d()}#Ee(){const e=document.getSelection();if(!e||e.isCollapsed)return;const t=this.#ye(e).closest(".textLayer"),n=this.getSelectionBoxes(t);n&&(this.#Q||=new Pae(this),this.#Q.show(t,n,"ltr"===this.direction))}addToAnnotationStorage(e){e.isEmpty()||!this.#A||this.#A.has(e.id)||this.#A.setValue(e.id,e)}#be(){const e=document.getSelection();if(!e||e.isCollapsed)return void(this.#ie&&(this.#Q?.hide(),this.#ie=null,this.#He({hasSelectedText:!1})));const{anchorNode:t}=e;if(t===this.#ie)return;const n=this.#ye(e).closest(".textLayer");if(n){if(this.#Q?.hide(),this.#ie=t,this.#He({hasSelectedText:!0}),(this.#oe===Pre.HIGHLIGHT||this.#oe===Pre.NONE)&&(this.#oe===Pre.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#X=this.isShiftKeyDown,!this.isShiftKeyDown)){const e=this.#oe===Pre.HIGHLIGHT?this.#Me(n):null;e?.toggleDrawing();const t=new AbortController,r=this.combinedSignal(t),a=n=>{"pointerup"===n.type&&0!==n.button||(t.abort(),e?.toggleDrawing(!0),"pointerup"===n.type&&this.#Ve("main_toolbar"))};window.addEventListener("pointerup",a,{signal:r}),window.addEventListener("blur",a,{signal:r})}}else this.#ie&&(this.#Q?.hide(),this.#ie=null,this.#He({hasSelectedText:!1}))}#Ve(e=""){this.#oe===Pre.HIGHLIGHT?this.highlightSelection(e):this.#U&&this.#Ee()}#fe(){document.addEventListener("selectionchange",this.#be.bind(this),{signal:this._signal})}#Ce(){if(this.#Y)return;this.#Y=new AbortController;const e=this.combinedSignal(this.#Y);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#Le(){this.#Y?.abort(),this.#Y=null}blur(){if(this.isShiftKeyDown=!1,this.#X&&(this.#X=!1,this.#Ve("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of this.#ce)if(t.div.contains(e)){this.#ne=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#ne)return;const[e,t]=this.#ne;this.#ne=null,t.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),t.focus()}#ge(){if(this.#te)return;this.#te=new AbortController;const e=this.combinedSignal(this.#te);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#ke(){this.#te?.abort(),this.#te=null}#we(){if(this.#_)return;this.#_=new AbortController;const e=this.combinedSignal(this.#_);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#Se(){this.#_?.abort(),this.#_=null}#ze(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#ge(),this.#we()}removeEditListeners(){this.#ke(),this.#Se()}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const n of this.#B)if(n.isHandlingMimeForPasting(t))return e.dataTransfer.dropEffect="copy",void e.preventDefault()}drop(e){for(const t of e.dataTransfer.items)for(const n of this.#B)if(n.isHandlingMimeForPasting(t.type))return n.paste(t,this.currentLayer),void e.preventDefault()}copy(e){if(e.preventDefault(),this.#S?.commitOrRemove(),!this.hasSelection)return;const t=[];for(const e of this.#ce){const n=e.serialize(!0);n&&t.push(n)}0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const e of t.items)for(const t of this.#B)if(t.isHandlingMimeForPasting(e.type))return void t.paste(e,this.currentLayer);let n=t.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(e){return void Yre(`paste: "${e.message}".`)}if(!Array.isArray(n))return;this.unselectAll();const r=this.currentLayer;try{const e=[];for(const t of n){const n=await r.deserialize(t);if(!n)return;e.push(n)}const t=()=>{for(const t of e)this.#xe(t);this.#Te(e)},a=()=>{for(const t of e)t.remove()};this.addCommands({cmd:t,undo:a,mustExec:!0})}catch(e){Yre(`paste: "${e.message}".`)}}keydown(e){this.isShiftKeyDown||"Shift"!==e.key||(this.isShiftKeyDown=!0),this.#oe===Pre.NONE||this.isEditorHandlingKeyboard||$ae._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&"Shift"===e.key&&(this.isShiftKeyDown=!1,this.#X&&(this.#X=!1,this.#Ve("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#He(e){Object.entries(e).some((([e,t])=>this.#he[e]!==t))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#he,e)}),this.#oe===Pre.HIGHLIGHT&&!1===e.hasSelectedEditor&&this.#Oe([[Fre.HIGHLIGHT_FREE,!0]]))}#Oe(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#Ce(),this.#we(),this.#He({isEditing:this.#oe!==Pre.NONE,isEmpty:this.#Ae(),hasSomethingToUndo:this.#N.hasSomethingToUndo(),hasSomethingToRedo:this.#N.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Le(),this.#Se(),this.#He({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#B){this.#B=e;for(const e of this.#B)this.#Oe(e.defaultPropertiesToUpdate)}}getId(){return this.#J.id}get currentLayer(){return this.#T.get(this.#P)}getLayer(e){return this.#T.get(e)}get currentPageIndex(){return this.#P}addLayer(e){this.#T.set(e.pageIndex,e),this.#Z?e.enable():e.disable()}removeLayer(e){this.#T.delete(e.pageIndex)}async updateMode(e,t=null,n=!1){if(this.#oe!==e&&(!this.#ve||(await this.#ve.promise,this.#ve))){if(this.#ve=Promise.withResolvers(),this.#oe=e,e===Pre.NONE)return this.setEditingState(!1),this.#Re(),this._editorUndoBar?.hide(),void this.#ve.resolve();this.setEditingState(!0),await this.#Ne(),this.unselectAll();for(const t of this.#T.values())t.updateMode(e);if(!t)return n&&this.addNewEditorFromKeyboard(),void this.#ve.resolve();for(const e of this.#x.values())e.annotationElementId===t?(this.setSelected(e),e.enterInEditMode()):e.unselect();this.#ve.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==this.#oe&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#B){switch(e){case Fre.CREATE:return void this.currentLayer.addNewEditor();case Fre.HIGHLIGHT_DEFAULT_COLOR:this.#re?.updateColor(t);break;case Fre.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#se||=new Map).set(e,t),this.showAllEditors("highlight",t)}for(const n of this.#ce)n.updateParams(e,t);for(const n of this.#B)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(const n of this.#x.values())n.editorType===e&&n.show(t);(this.#se?.get(Fre.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#Oe([[Fre.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#ee!==e){this.#ee=e;for(const t of this.#T.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}async#Ne(){if(!this.#Z){this.#Z=!0;const e=[];for(const t of this.#T.values())e.push(t.enable());await Promise.all(e);for(const e of this.#x.values())e.enable()}}#Re(){if(this.unselectAll(),this.#Z){this.#Z=!1;for(const e of this.#T.values())e.disable();for(const e of this.#x.values())e.disable()}}getEditors(e){const t=[];for(const n of this.#x.values())n.pageIndex===e&&t.push(n);return t}getEditor(e){return this.#x.get(e)}addEditor(e){this.#x.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#G&&clearTimeout(this.#G),this.#G=setTimeout((()=>{this.focusMainContainer(),this.#G=null}),0)),this.#x.delete(e.id),this.unselect(e),e.annotationElementId&&this.#F.has(e.annotationElementId)||this.#A?.remove(e.id)}addDeletedAnnotationElement(e){this.#F.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#F.has(e)}removeDeletedAnnotationElement(e){this.#F.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#xe(e){const t=this.#T.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#S!==e&&(this.#S=e,e&&this.#Oe(e.propertiesToUpdate))}get#_e(){let e=null;for(e of this.#ce);return e}updateUI(e){this.#_e===e&&this.#Oe(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#Oe(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#ce.has(e))return this.#ce.delete(e),e.unselect(),void this.#He({hasSelectedEditor:this.hasSelection});this.#ce.add(e),e.select(),this.#Oe(e.propertiesToUpdate),this.#He({hasSelectedEditor:!0})}setSelected(e){this.#D?.commitOrRemove();for(const t of this.#ce)t!==e&&t.unselect();this.#ce.clear(),this.#ce.add(e),e.select(),this.#Oe(e.propertiesToUpdate),this.#He({hasSelectedEditor:!0})}isSelected(e){return this.#ce.has(e)}get firstSelectedEditor(){return this.#ce.values().next().value}unselect(e){e.unselect(),this.#ce.delete(e),this.#He({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#ce.size}get isEnterHandled(){return 1===this.#ce.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#N.undo(),this.#He({hasSomethingToUndo:this.#N.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#Ae()}),this._editorUndoBar?.hide()}redo(){this.#N.redo(),this.#He({hasSomethingToUndo:!0,hasSomethingToRedo:this.#N.hasSomethingToRedo(),isEmpty:this.#Ae()})}addCommands(e){this.#N.add(e),this.#He({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#Ae()})}cleanUndoStack(e){this.#N.cleanType(e)}#Ae(){if(0===this.#x.size)return!0;if(1===this.#x.size)for(const e of this.#x.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();const e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...this.#ce],n=()=>{for(const e of t)this.#xe(e)};this.addCommands({cmd:()=>{this._editorUndoBar?.show(n,1===t.length?t[0].editorType:t.length);for(const e of t)e.remove()},undo:n,mustExec:!0})}commitOrRemove(){this.#S?.commitOrRemove()}hasSomethingToControl(){return this.#S||this.hasSelection}#Te(e){for(const e of this.#ce)e.unselect();this.#ce.clear();for(const t of e)t.isEmpty()||(this.#ce.add(t),t.select());this.#He({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#ce)e.commit();this.#Te(this.#x.values())}unselectAll(){if((!this.#S||(this.#S.commitOrRemove(),this.#oe===Pre.NONE))&&!this.#D?.commitOrRemove()&&this.hasSelection){for(const e of this.#ce)e.unselect();this.#ce.clear(),this.#He({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#de[0]+=e,this.#de[1]+=t;const[r,a]=this.#de,o=[...this.#ce];this.#ue&&clearTimeout(this.#ue),this.#ue=setTimeout((()=>{this.#ue=null,this.#de[0]=this.#de[1]=0,this.addCommands({cmd:()=>{for(const e of o)this.#x.has(e.id)&&e.translateInPage(r,a)},undo:()=>{for(const e of o)this.#x.has(e.id)&&e.translateInPage(-r,-a)},mustExec:!1})}),1e3);for(const n of o)n.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#I=new Map;for(const e of this.#ce)this.#I.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#I)return!1;this.disableUserSelect(!1);const e=this.#I;this.#I=null;let t=!1;for(const[{x:n,y:r,pageIndex:a},o]of e)o.newX=n,o.newY=r,o.newPageIndex=a,t||=n!==o.savedX||r!==o.savedY||a!==o.savedPageIndex;if(!t)return!1;const n=(e,t,n,r)=>{if(this.#x.has(e.id)){const a=this.#T.get(r);a?e._setParentAndPosition(a,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(const[t,{newX:r,newY:a,newPageIndex:o}]of e)n(t,r,a,o)},undo:()=>{for(const[t,{savedX:r,savedY:a,savedPageIndex:o}]of e)n(t,r,a,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#I)for(const n of this.#I.keys())n.drag(e,t)}rebuild(e){if(null===e.parent){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#ce.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#S===e}getActive(){return this.#S}getMode(){return this.#oe}get imageManager(){return Jre(this,"imageManager",new Bae)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let n=0,r=t.rangeCount;n<r;n++)if(!e.contains(t.getRangeAt(n).commonAncestorContainer))return null;const{x:n,y:r,width:a,height:o}=e.getBoundingClientRect();let c;switch(e.getAttribute("data-main-rotation")){case"90":c=(e,t,c,i)=>({x:(t-r)/o,y:1-(e+c-n)/a,width:i/o,height:c/a});break;case"180":c=(e,t,c,i)=>({x:1-(e+c-n)/a,y:1-(t+i-r)/o,width:c/a,height:i/o});break;case"270":c=(e,t,c,i)=>({x:1-(t+i-r)/o,y:(e-n)/a,width:i/o,height:c/a});break;default:c=(e,t,c,i)=>({x:(e-n)/a,y:(t-r)/o,width:c/a,height:i/o})}const i=[];for(let e=0,n=t.rangeCount;e<n;e++){const n=t.getRangeAt(e);if(!n.collapsed)for(const{x:e,y:t,width:r,height:a}of n.getClientRects())0!==r&&0!==a&&i.push(c(e,t,r,a))}return 0===i.length?null:i}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#R||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#R?.delete(e)}renderAnnotationElement(e){const t=this.#R?.get(e.data.id);if(!t)return;const n=this.#A.getRawValue(t);n&&(this.#oe!==Pre.NONE||n.hasBeenModified)&&n.renderAnnotationElement(e)}}class qae{#i=null;#De=!1;#Pe=null;#Fe=null;#Ie=null;#Be=null;#je=!1;#Ue=null;#o=null;#We=null;#$e=null;#qe=!1;static#Ge=null;static _l10n=null;constructor(e){this.#o=e,this.#qe=e._uiManager.useNewAltTextFlow,qae.#Ge||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){qae._l10n??=e}async render(){const e=this.#Pe=document.createElement("button");e.className="altText",e.tabIndex="0";const t=this.#Fe=document.createElement("span");e.append(t),this.#qe?(e.classList.add("new"),e.setAttribute("data-l10n-id",qae.#Ge.missing),t.setAttribute("data-l10n-id",qae.#Ge["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const n=this.#o._uiManager._signal;e.addEventListener("contextmenu",wae,{signal:n}),e.addEventListener("pointerdown",(e=>e.stopPropagation()),{signal:n});const r=e=>{e.preventDefault(),this.#o._uiManager.editAltText(this.#o),this.#qe&&this.#o._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#Ye}})};return e.addEventListener("click",r,{capture:!0,signal:n}),e.addEventListener("keydown",(t=>{t.target===e&&"Enter"===t.key&&(this.#je=!0,r(t))}),{signal:n}),await this.#Ke(),e}get#Ye(){return(this.#i?"added":null===this.#i&&this.guessedText&&"review")||"missing"}finish(){this.#Pe&&(this.#Pe.focus({focusVisible:this.#je}),this.#je=!1)}isEmpty(){return this.#qe?null===this.#i:!this.#i&&!this.#De}hasData(){return this.#qe?null!==this.#i||!!this.#We:this.isEmpty()}get guessedText(){return this.#We}async setGuessedText(e){null===this.#i&&(this.#We=e,this.#$e=await qae._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#Ke())}toggleAltTextBadge(e=!1){if(!this.#qe||this.#i)return this.#Ue?.remove(),void(this.#Ue=null);if(!this.#Ue){const e=this.#Ue=document.createElement("div");e.className="noAltTextBadge",this.#o.div.append(e)}this.#Ue.classList.toggle("hidden",!e)}serialize(e){let t=this.#i;return e||this.#We!==t||(t=this.#$e),{altText:t,decorative:this.#De,guessedText:this.#We,textWithDisclaimer:this.#$e}}get data(){return{altText:this.#i,decorative:this.#De}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:r,cancel:a=!1}){n&&(this.#We=n,this.#$e=r),this.#i===e&&this.#De===t||(a||(this.#i=e,this.#De=t),this.#Ke())}toggle(e=!1){this.#Pe&&(!e&&this.#Be&&(clearTimeout(this.#Be),this.#Be=null),this.#Pe.disabled=!e)}shown(){this.#o._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#Ye}})}destroy(){this.#Pe?.remove(),this.#Pe=null,this.#Fe=null,this.#Ie=null,this.#Ue?.remove(),this.#Ue=null}async#Ke(){const e=this.#Pe;if(!e)return;if(this.#qe){if(e.classList.toggle("done",!!this.#i),e.setAttribute("data-l10n-id",qae.#Ge[this.#Ye]),this.#Fe?.setAttribute("data-l10n-id",qae.#Ge[`${this.#Ye}-label`]),!this.#i)return void this.#Ie?.remove()}else{if(!this.#i&&!this.#De)return e.classList.remove("done"),void this.#Ie?.remove();e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=this.#Ie;if(!t){this.#Ie=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${this.#o.id}`;const n=100,r=this.#o._uiManager._signal;r.addEventListener("abort",(()=>{clearTimeout(this.#Be),this.#Be=null}),{once:!0}),e.addEventListener("mouseenter",(()=>{this.#Be=setTimeout((()=>{this.#Be=null,this.#Ie.classList.add("show"),this.#o._reportTelemetry({action:"alt_text_tooltip"})}),n)}),{signal:r}),e.addEventListener("mouseleave",(()=>{this.#Be&&(clearTimeout(this.#Be),this.#Be=null),this.#Ie?.classList.remove("show")}),{signal:r})}this.#De?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=this.#i),t.parentNode||e.append(t);const n=this.#o.getImageForAltText();n?.setAttribute("aria-describedby",t.id)}}class Gae{#me;#Xe=!1;#Qe=null;#Je;#Ze;#et;#tt;#nt;#rt=null;#at;#ot=null;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:r=null,onPinching:a=null,onPinchEnd:o=null,signal:c}){this.#me=e,this.#Qe=n,this.#Je=t,this.#Ze=r,this.#et=a,this.#tt=o,this.#at=new AbortController,this.#nt=AbortSignal.any([c,this.#at.signal]),e.addEventListener("touchstart",this.#ct.bind(this),{passive:!1,signal:this.#nt})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return Jre(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}#ct(e){if(this.#Je?.()||e.touches.length<2)return;if(!this.#ot){this.#ot=new AbortController;const e=AbortSignal.any([this.#nt,this.#ot.signal]),t=this.#me,n={signal:e,passive:!1};t.addEventListener("touchmove",this.#it.bind(this),n),t.addEventListener("touchend",this.#lt.bind(this),n),t.addEventListener("touchcancel",this.#lt.bind(this),n),this.#Ze?.()}if(Sae(e),2!==e.touches.length||this.#Qe?.())return void(this.#rt=null);let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]),this.#rt={touch0X:t.screenX,touch0Y:t.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#it(e){if(!this.#rt||2!==e.touches.length)return;let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]);const{screenX:r,screenY:a}=t,{screenX:o,screenY:c}=n,i=this.#rt,{touch0X:l,touch0Y:s,touch1X:h,touch1Y:d}=i,u=h-l,m=d-s,p=o-r,v=c-a,f=Math.hypot(p,v)||1,z=Math.hypot(u,m)||1;if(!this.#Xe&&Math.abs(z-f)<=Gae.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(i.touch0X=r,i.touch0Y=a,i.touch1X=o,i.touch1Y=c,e.preventDefault(),!this.#Xe)return void(this.#Xe=!0);const g=[(r+o)/2,(a+c)/2];this.#et?.(g,z,f)}#lt(e){this.#ot.abort(),this.#ot=null,this.#tt?.(),this.#rt&&(e.preventDefault(),this.#rt=null,this.#Xe=!1)}destroy(){this.#at?.abort(),this.#at=null}}class Yae{#st=null;#ht=null;#i=null;#dt=!1;#ut=null;#mt="";#pt=!1;#vt=null;#ft=null;#zt=null;#gt=null;#yt="";#Mt=!1;#Et=null;#bt=!1;#Ht=!1;#Vt=!1;#Ct=null;#Lt=0;#kt=0;#wt=null;#St=null;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#xt=!1;#Tt=Yae._zIndex++;static _borderLineWidth=-1;static _colorManager=new Wae;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const e=Yae.prototype._resizeWithKeyboard,t=$ae.TRANSLATE_SMALL,n=$ae.TRANSLATE_BIG;return Jre(this,"_resizerKeyboardManager",new Uae([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,n]}],[["Escape","mac+Escape"],Yae.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:o}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[a,o];const[c,i]=this.parentDimensions;this.x=e.x/c,this.y=e.y/i,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return Jre(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new Kae({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(Yae._l10n??=e,Yae._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),-1!==Yae._borderLineWidth)return;const n=getComputedStyle(document.documentElement);Yae._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Kre("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#xt}set _isDraggable(e){this.#xt=e,this.div?.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(2*e),this.y+=this.width*e/(2*t);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(2*e),this.y-=this.width*e/(2*t);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#Tt}setParent(e){null!==e?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):this.#Ot(),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#Mt?this.#Mt=!1:this.parent.setSelected(this))}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const t=e.relatedTarget;t?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){const[a,o]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/a,this.y=(t+r)/o,this.fixAndSetPosition()}#At([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#At(this.parentDimensions,e,t)}translateInPage(e,t){this.#Et||=[this.x,this.y,this.width,this.height],this.#At(this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){this.#Et||=[this.x,this.y,this.width,this.height];const{div:n,parentDimensions:[r,a]}=this;if(this.x+=e/r,this.y+=t/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:c}=this;const[i,l]=this.getBaseTranslation();o+=i,c+=l;const{style:s}=n;s.left=`${(100*o).toFixed(2)}%`,s.top=`${(100*c).toFixed(2)}%`,this._onTranslating(o,c),n.scrollIntoView({block:"nearest"})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#Et&&(this.#Et[0]!==this.x||this.#Et[1]!==this.y)}get _hasBeenResized(){return!!this.#Et&&(this.#Et[2]!==this.width||this.#Et[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:n}=Yae,r=n/e,a=n/t;switch(this.rotation){case 90:return[-r,a];case 180:return[r,a];case 270:return[r,-a];default:return[-r,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[n,r]}=this;let{x:a,y:o,width:c,height:i}=this;if(c*=n,i*=r,a*=n,o*=r,this._mustFixPosition)switch(e){case 0:a=Math.max(0,Math.min(n-c,a)),o=Math.max(0,Math.min(r-i,o));break;case 90:a=Math.max(0,Math.min(n-i,a)),o=Math.min(r,Math.max(c,o));break;case 180:a=Math.min(n,Math.max(c,a)),o=Math.min(r,Math.max(i,o));break;case 270:a=Math.min(n,Math.max(i,a)),o=Math.max(0,Math.min(r-c,o))}this.x=a/=n,this.y=o/=r;const[l,s]=this.getBaseTranslation();a+=l,o+=s,t.left=`${(100*a).toFixed(2)}%`,t.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}static#Rt(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return Yae.#Rt(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return Yae.#Rt(e,t,360-this.parentRotation)}#Nt(e){switch(e){case 90:{const[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(e,t){const[n,r]=this.parentDimensions,{style:a}=this.div;a.width=`${(100*e/n).toFixed(2)}%`,this.#pt||(a.height=`${(100*t/r).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:n}=e,r=n.endsWith("%"),a=!this.#pt&&t.endsWith("%");if(r&&a)return;const[o,c]=this.parentDimensions;r||(e.width=`${(100*parseFloat(n)/o).toFixed(2)}%`),this.#pt||a||(e.height=`${(100*parseFloat(t)/c).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#_t(){if(this.#vt)return;this.#vt=document.createElement("div"),this.#vt.classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const n of e){const e=document.createElement("div");this.#vt.append(e),e.classList.add("resizer",n),e.setAttribute("data-resizer-name",n),e.addEventListener("pointerdown",this.#Dt.bind(this,n),{signal:t}),e.addEventListener("contextmenu",wae,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#vt)}#Dt(e,t){t.preventDefault();const{isMac:n}=hae.platform;if(0!==t.button||t.ctrlKey&&n)return;this.#i?.toggle(!1);const r=this._isDraggable;this._isDraggable=!1,this.#ft=[t.screenX,t.screenY];const a=new AbortController,o=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#Pt.bind(this,e),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",Sae,{passive:!1,signal:o}),window.addEventListener("contextmenu",wae,{signal:o}),this.#zt={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const c=this.parent.div.style.cursor,i=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const l=()=>{a.abort(),this.parent.togglePointerEvents(!0),this.#i?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=c,this.div.style.cursor=i,this.#Ft()};window.addEventListener("pointerup",l,{signal:o}),window.addEventListener("blur",l,{signal:o})}#It(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t;const[a,o]=this.parentDimensions;this.setDims(a*n,o*r),this.fixAndSetPosition(),this._onResized()}_onResized(){}#Ft(){if(!this.#zt)return;const{savedX:e,savedY:t,savedWidth:n,savedHeight:r}=this.#zt;this.#zt=null;const a=this.x,o=this.y,c=this.width,i=this.height;a===e&&o===t&&c===n&&i===r||this.addCommands({cmd:this.#It.bind(this,a,o,c,i),undo:this.#It.bind(this,e,t,n,r),mustExec:!0})}static _round(e){return Math.round(1e4*e)/1e4}#Pt(e,t){const[n,r]=this.parentDimensions,a=this.x,o=this.y,c=this.width,i=this.height,l=Yae.MIN_SIZE/n,s=Yae.MIN_SIZE/r,h=this.#Nt(this.rotation),d=(e,t)=>[h[0]*e+h[2]*t,h[1]*e+h[3]*t],u=this.#Nt(360-this.rotation);let m,p,v=!1,f=!1;switch(e){case"topLeft":v=!0,m=(e,t)=>[0,0],p=(e,t)=>[e,t];break;case"topMiddle":m=(e,t)=>[e/2,0],p=(e,t)=>[e/2,t];break;case"topRight":v=!0,m=(e,t)=>[e,0],p=(e,t)=>[0,t];break;case"middleRight":f=!0,m=(e,t)=>[e,t/2],p=(e,t)=>[0,t/2];break;case"bottomRight":v=!0,m=(e,t)=>[e,t],p=(e,t)=>[0,0];break;case"bottomMiddle":m=(e,t)=>[e/2,t],p=(e,t)=>[e/2,0];break;case"bottomLeft":v=!0,m=(e,t)=>[0,t],p=(e,t)=>[e,0];break;case"middleLeft":f=!0,m=(e,t)=>[0,t/2],p=(e,t)=>[e,t/2]}const z=m(c,i),g=p(c,i);let y=d(...g);const M=Yae._round(a+y[0]),E=Yae._round(o+y[1]);let b,H,V=1,C=1;if(t.fromKeyboard)({deltaX:b,deltaY:H}=t);else{const{screenX:e,screenY:n}=t,[r,a]=this.#ft;[b,H]=this.screenToPageTranslation(e-r,n-a),this.#ft[0]=e,this.#ft[1]=n}var L,k;if([b,H]=(L=b/n,k=H/r,[u[0]*L+u[2]*k,u[1]*L+u[3]*k]),v){const e=Math.hypot(c,i);V=C=Math.max(Math.min(Math.hypot(g[0]-z[0]-b,g[1]-z[1]-H)/e,1/c,1/i),l/c,s/i)}else f?V=Math.max(l,Math.min(1,Math.abs(g[0]-z[0]-b)))/c:C=Math.max(s,Math.min(1,Math.abs(g[1]-z[1]-H)))/i;const w=Yae._round(c*V),S=Yae._round(i*C);y=d(...p(w,S));const x=M-y[0],T=E-y[1];this.#Et||=[this.x,this.y,this.width,this.height],this.width=w,this.height=S,this.x=x,this.y=T,this.setDims(n*w,r*S),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#i?.finish()}async addEditToolbar(){return this._editToolbar||this.#Ht||(this._editToolbar=new Dae(this),this.div.append(this._editToolbar.render()),this.#i&&await this._editToolbar.addAltText(this.#i)),this._editToolbar}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#i?.destroy())}addContainer(e){const t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#i||(qae.initialize(Yae._l10n),this.#i=new qae(this),this.#st&&(this.#i.data=this.#st,this.#st=null),await this.addEditToolbar())}get altTextData(){return this.#i?.data}set altTextData(e){this.#i&&(this.#i.data=e)}get guessedAltText(){return this.#i?.guessedText}async setGuessedAltText(e){await(this.#i?.setGuessedText(e))}serializeAltText(e){return this.#i?.serialize(e)}hasAltText(){return!!this.#i&&!this.#i.isEmpty()}hasAltTextData(){return this.#i?.hasData()??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#dt?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.#Bt();const[e,t]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);const[n,r]=this.getInitialTranslation();return this.translate(n,r),Fae(this,this.div,["pointerdown"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#St||=new Gae({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#jt.bind(this),onPinching:this.#Ut.bind(this),onPinchEnd:this.#Wt.bind(this),signal:this._uiManager._signal})),this._uiManager._editorUndoBar?.hide(),this.div}#jt(){this.#zt={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#i?.toggle(!1),this.parent.togglePointerEvents(!1)}#Ut(e,t,n){let r=n/t*.7+1-.7;if(1===r)return;const a=this.#Nt(this.rotation),o=(e,t)=>[a[0]*e+a[2]*t,a[1]*e+a[3]*t],[c,i]=this.parentDimensions,l=this.x,s=this.y,h=this.width,d=this.height,u=Yae.MIN_SIZE/c,m=Yae.MIN_SIZE/i;r=Math.max(Math.min(r,1/h,1/d),u/h,m/d);const p=Yae._round(h*r),v=Yae._round(d*r);if(p===h&&v===d)return;this.#Et||=[l,s,h,d];const f=o(h/2,d/2),z=Yae._round(l+f[0]),g=Yae._round(s+f[1]),y=o(p/2,v/2);this.x=z-y[0],this.y=g-y[1],this.width=p,this.height=v,this.setDims(c*p,i*v),this.fixAndSetPosition(),this._onResizing()}#Wt(){this.#i?.toggle(!0),this.parent.togglePointerEvents(!0),this.#Ft()}pointerdown(e){const{isMac:t}=hae.platform;0!==e.button||e.ctrlKey&&t?e.preventDefault():(this.#Mt=!0,this._isDraggable?this.#$t(e):this.#qt(e))}get isSelected(){return this._uiManager.isSelected(this)}#qt(e){const{isMac:t}=hae.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#$t(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1;const r=new AbortController,a=this._uiManager.combinedSignal(r),o={capture:!0,passive:!1,signal:a},c=e=>{r.abort(),this.#ut=null,this.#Mt=!1,this._uiManager.endDragSession()||this.#qt(e),n&&this._onStopDragging()};t&&(this.#Lt=e.clientX,this.#kt=e.clientY,this.#ut=e.pointerId,this.#mt=e.pointerType,window.addEventListener("pointermove",(e=>{n||(n=!0,this._onStartDragging());const{clientX:t,clientY:r,pointerId:a}=e;if(a!==this.#ut)return void Sae(e);const[o,c]=this.screenToPageTranslation(t-this.#Lt,r-this.#kt);this.#Lt=t,this.#kt=r,this._uiManager.dragSelectedEditors(o,c)}),o),window.addEventListener("touchmove",Sae,o),window.addEventListener("pointerdown",(e=>{e.pointerType===this.#mt&&(this.#St||e.isPrimary)&&c(e),Sae(e)}),o));const i=e=>{this.#ut&&this.#ut!==e.pointerId?Sae(e):c(e)};window.addEventListener("pointerup",i,{signal:a}),window.addEventListener("blur",i,{signal:a})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#Ct&&clearTimeout(this.#Ct),this.#Ct=setTimeout((()=>{this.#Ct=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){const r=this.parentScale,[a,o]=this.pageDimensions,[c,i]=this.pageTranslation,l=e/r,s=t/r,h=this.x*a,d=this.y*o,u=this.width*a,m=this.height*o;switch(n){case 0:return[h+l+c,o-d-s-m+i,h+l+u+c,o-d-s+i];case 90:return[h+s+c,o-d+l+i,h+s+m+c,o-d+l+u+i];case 180:return[h-l-u+c,o-d+s+i,h-l+c,o-d+s+m+i];case 270:return[h-s-m+c,o-d-l-u+i,h-s+c,o-d-l+i];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[n,r,a,o]=e,c=a-n,i=o-r;switch(this.rotation){case 0:return[n,t-o,c,i];case 90:return[n,t-r,i,c];case 180:return[a,t-r,c,i];case 270:return[a,t-o,i,c];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){this.#Ht=!0}disableEditMode(){this.#Ht=!1}isInEditMode(){return this.#Ht}shouldGetKeyboardEvents(){return this.#Vt}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:a,innerWidth:o}=window;return t<o&&r>0&&e<a&&n>0}#Bt(){if(this.#gt||!this.div)return;this.#gt=new AbortController;const e=this._uiManager.combinedSignal(this.#gt);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#Bt()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,t=null){Kre("An editor must be serializable")}static async deserialize(e,t,n){const r=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:n});r.rotation=e.rotation,r.#st=e.accessibilityData;const[a,o]=r.pageDimensions,[c,i,l,s]=r.getRectInCurrentCoords(e.rect,o);return r.x=c/a,r.y=i/o,r.width=l/a,r.height=s/o,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#gt?.abort(),this.#gt=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#Ct&&(clearTimeout(this.#Ct),this.#Ct=null),this.#Ot(),this.removeEditToolbar(),this.#wt){for(const e of this.#wt.values())clearTimeout(e);this.#wt=null}this.parent=null,this.#St?.destroy(),this.#St=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#_t(),this.#vt.classList.remove("hidden"),Fae(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||"Enter"!==e.key)return;this._uiManager.setSelected(this),this.#zt={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const t=this.#vt.children;if(!this.#ht){this.#ht=Array.from(t);const e=this.#Gt.bind(this),n=this.#Yt.bind(this),r=this._uiManager._signal;for(const t of this.#ht){const a=t.getAttribute("data-resizer-name");t.setAttribute("role","spinbutton"),t.addEventListener("keydown",e,{signal:r}),t.addEventListener("blur",n,{signal:r}),t.addEventListener("focus",this.#Kt.bind(this,a),{signal:r}),t.setAttribute("data-l10n-id",Yae._l10nResizer[a])}}const n=this.#ht[0];let r=0;for(const e of t){if(e===n)break;r++}const a=(360-this.rotation+this.parentRotation)%360/90*(this.#ht.length/4);if(a!==r){if(a<r)for(let e=0;e<r-a;e++)this.#vt.append(this.#vt.firstChild);else if(a>r)for(let e=0;e<a-r;e++)this.#vt.firstChild.before(this.#vt.lastChild);let e=0;for(const n of t){const t=this.#ht[e++].getAttribute("data-resizer-name");n.setAttribute("data-l10n-id",Yae._l10nResizer[t])}}this.#Xt(0),this.#Vt=!0,this.#vt.firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#Gt(e){Yae._resizerKeyboardManager.exec(this,e)}#Yt(e){this.#Vt&&e.relatedTarget?.parentNode!==this.#vt&&this.#Ot()}#Kt(e){this.#yt=this.#Vt?e:""}#Xt(e){if(this.#ht)for(const t of this.#ht)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#Vt&&this.#Pt(this.#yt,{deltaX:e,deltaY:t,fromKeyboard:!0})}#Ot(){this.#Vt=!1,this.#Xt(-1),this.#Ft()}_stopResizingWithKeyboard(){this.#Ot(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar?(this._editToolbar?.show(),this.#i?.toggleAltTextBadge(!1)):this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()}))}unselect(){this.#vt?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#i?.toggleAltTextBadge(!0)}updateParams(e,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#bt}set isEditing(e){this.#bt=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#pt=!0;const n=e/t,{style:r}=this.div;r.aspectRatio=n,r.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){this.#wt||=new Map;const{action:t}=e;let n=this.#wt.get(t);return n&&clearTimeout(n),n=setTimeout((()=>{this._reportTelemetry(e),this.#wt.delete(t),0===this.#wt.size&&(this.#wt=null)}),Yae._telemetryTimeout),void this.#wt.set(t,n)}e.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#dt=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#dt=!0}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(t){if("CANVAS"===t.nodeName){const e=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.before(t)}}else t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);return t}resetAnnotationElement(e){const{firstChild:t}=e.container;"DIV"===t?.nodeName&&t.classList.contains("annotationContent")&&t.remove()}}class Kae extends Yae{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Xae=3285377520,Qae=4294901760,Jae=65535;class Zae{constructor(e){this.h1=e?4294967295&e:Xae,this.h2=e?4294967295&e:Xae}update(e){let t,n;if("string"==typeof e){t=new Uint8Array(2*e.length),n=0;for(let r=0,a=e.length;r<a;r++){const a=e.charCodeAt(r);a<=255?t[n++]=a:(t[n++]=a>>>8,t[n++]=255&a)}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice(),n=t.byteLength}const r=n>>2,a=n-4*r,o=new Uint32Array(t.buffer,0,r);let c=0,i=0,l=this.h1,s=this.h2;const h=3432918353,d=461845907,u=11601,m=13715;for(let e=0;e<r;e++)1&e?(c=o[e],c=c*h&Qae|c*u&Jae,c=c<<15|c>>>17,c=c*d&Qae|c*m&Jae,l^=c,l=l<<13|l>>>19,l=5*l+3864292196):(i=o[e],i=i*h&Qae|i*u&Jae,i=i<<15|i>>>17,i=i*d&Qae|i*m&Jae,s^=i,s=s<<13|s>>>19,s=5*s+3864292196);switch(c=0,a){case 3:c^=t[4*r+2]<<16;case 2:c^=t[4*r+1]<<8;case 1:c^=t[4*r],c=c*h&Qae|c*u&Jae,c=c<<15|c>>>17,c=c*d&Qae|c*m&Jae,1&r?l^=c:s^=c}this.h1=l,this.h2=s}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=3981806797*e&Qae|36045*e&Jae,t=4283543511*t&Qae|(2950163797*(t<<16|e>>>16)&Qae)>>>16,e^=t>>>1,e=444984403*e&Qae|60499*e&Jae,t=3301882366*t&Qae|(3120437893*(t<<16|e>>>16)&Qae)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const eoe=Object.freeze({map:null,hash:"",transfer:void 0});class toe{#Qt=!1;#Jt=null;#Zt=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const n=this.#Zt.get(e);return void 0===n?t:Object.assign(t,n)}getRawValue(e){return this.#Zt.get(e)}remove(e){if(this.#Zt.delete(e),0===this.#Zt.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this.#Zt.values())if(e instanceof Yae)return;this.onAnnotationEditor(null)}}setValue(e,t){const n=this.#Zt.get(e);let r=!1;if(void 0!==n)for(const[e,a]of Object.entries(t))n[e]!==a&&(r=!0,n[e]=a);else r=!0,this.#Zt.set(e,t);r&&this.#en(),t instanceof Yae&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#Zt.has(e)}getAll(){return this.#Zt.size>0?sae(this.#Zt):null}setAll(e){for(const[t,n]of Object.entries(e))this.setValue(t,n)}get size(){return this.#Zt.size}#en(){this.#Qt||(this.#Qt=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#Qt&&(this.#Qt=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new noe(this)}get serializable(){if(0===this.#Zt.size)return eoe;const e=new Map,t=new Zae,n=[],r=Object.create(null);let a=!1;for(const[n,o]of this.#Zt){const c=o instanceof Yae?o.serialize(!1,r):o;c&&(e.set(n,c),t.update(`${n}:${JSON.stringify(c)}`),a||=!!c.bitmap)}if(a)for(const t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:eoe}get editorStats(){let e=null;const t=new Map;for(const n of this.#Zt.values()){if(!(n instanceof Yae))continue;const r=n.telemetryFinalData;if(!r)continue;const{type:a}=r;t.has(a)||t.set(a,Object.getPrototypeOf(n).constructor),e||=Object.create(null);const o=e[a]||=new Map;for(const[e,t]of Object.entries(r)){if("type"===e)continue;let n=o.get(e);n||(n=new Map,o.set(e,n));const r=n.get(t)??0;n.set(t,r+1)}}for(const[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){this.#Jt=null}get modifiedIds(){if(this.#Jt)return this.#Jt;const e=[];for(const t of this.#Zt.values())t instanceof Yae&&t.annotationElementId&&t.serialize()&&e.push(t.annotationElementId);return this.#Jt={ids:new Set(e),hash:e.join(",")}}}class noe extends toe{#tn;constructor(e){super();const{map:t,hash:n,transfer:r}=e.serializable,a=structuredClone(t,r?{transfer:r}:null);this.#tn={map:a,hash:n,transfer:r}}get print(){Kre("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#tn}get modifiedIds(){return Jre(this,"modifiedIds",{ids:new Set,hash:""})}}class roe{#nn=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#nn.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:t}){if(e&&!this.#nn.has(e.loadedName))if(Xre(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:r,style:a}=e,o=new FontFace(n,r,a);this.addNativeFontFace(o);try{await o.load(),this.#nn.add(n),t?.(e)}catch{Yre(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}}else Kre("Not implemented: loadSystemFont without the Font Loading API.")}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo)return void await this.loadSystemFont(e);if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw Yre(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((t=>{const n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)}))}}get isFontLoadingAPISupported(){return Jre(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let e=!1;return(Are||"undefined"!=typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),Jre(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,n={done:!1,complete:function(){for(Xre(!n.done,"completeRequest() cannot be called twice."),n.done=!0;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(n),n}get _loadTestFont(){return Jre(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function r(e,t,n,r){return e.substring(0,t)+r+e.substring(t+n)}let a,o;const c=this._document.createElement("canvas");c.width=1,c.height=1;const i=c.getContext("2d");let l=0;const s=`lt${Date.now()}${this.loadTestFontId++}`;let h=this._loadTestFont;h=r(h,976,s.length,s);const d=1482184792;let u=n(h,16);for(a=0,o=s.length-3;a<o;a+=4)u=u-d+n(s,a)|0;a<s.length&&(u=u-d+n(s+"XXX",a)|0),h=r(h,16,4,function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}(u));const m=`@font-face {font-family:"${s}";src:url(data:font/opentype;base64,${btoa(h)});}`;this.insertRule(m);const p=this._document.createElement("div");p.style.visibility="hidden",p.style.width=p.style.height="10px",p.style.position="absolute",p.style.top=p.style.left="0px";for(const t of[e.loadedName,s]){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,p.append(e)}this._document.body.append(p),function e(t,n){if(++l>30)return Yre("Load test font never loaded."),void n();i.font="30px "+t,i.fillText(".",0,20),i.getImageData(0,0,1,1).data[3]>0?n():setTimeout(e.bind(null,t,n))}(s,(()=>{p.remove(),t.complete()}))}}class aoe{constructor(e,{disableFontFace:t=!1,fontExtraProperties:n=!1,inspectFont:r=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.disableFontFace=!0===t,this.fontExtraProperties=!0===n,this._inspectFont=r}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${t=this.data,Uint8Array.prototype.toBase64?t.toBase64():btoa(iae(t))});`;var t;let n;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${e}}`}else n=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this._inspectFont?.(this,e),n}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];const n=this.loadedName+"_path_"+t;let r;try{r=e.get(n)}catch(e){Yre(`getPathGenerator - ignoring character: "${e}".`)}const a=new Path2D(r||"");return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=a}}function ooe(){}function coe(e){if(e instanceof cae||e instanceof nae||e instanceof rae||e instanceof eae||e instanceof aae||e instanceof tae)return e;switch(e instanceof Error||"object"==typeof e&&null!==e||Kre('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new cae(e.message);case"InvalidPDFException":return new nae(e.message);case"MissingPDFException":return new rae(e.message);case"PasswordException":return new eae(e.message,e.code);case"UnexpectedResponseException":return new aae(e.message,e.status);case"UnknownErrorException":return new tae(e.message,e.details)}return new tae(e.message,e.toString())}class ioe{#rn=new AbortController;constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener("message",this.#an.bind(this),{signal:this.#rn.signal})}#an({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#on(e);if(e.callback){const t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],1===e.callback)n.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");n.reject(coe(e.reason))}return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const n=this.sourceName,r=e.sourceName,a=this.comObj;Promise.try(t,e.data).then((function(t){a.postMessage({sourceName:n,targetName:r,callback:1,callbackId:e.callbackId,data:t})}),(function(t){a.postMessage({sourceName:n,targetName:r,callback:2,callbackId:e.callbackId,reason:coe(t)})}))}else e.streamId?this.#cn(e):t(e.data)}on(e,t){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){const r=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[r]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(e){a.reject(e)}return a.promise}sendWithStream(e,t,n,r){const a=this.streamId++,o=this.sourceName,c=this.targetName,i=this.comObj;return new ReadableStream({start:n=>{const l=Promise.withResolvers();return this.streamControllers[a]={controller:n,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},i.postMessage({sourceName:o,targetName:c,action:e,streamId:a,data:t,desiredSize:n.desiredSize},r),l.promise},pull:e=>{const t=Promise.withResolvers();return this.streamControllers[a].pullCall=t,i.postMessage({sourceName:o,targetName:c,stream:6,streamId:a,desiredSize:e.desiredSize}),t.promise},cancel:e=>{Xre(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();return this.streamControllers[a].cancelCall=t,this.streamControllers[a].isClosed=!0,i.postMessage({sourceName:o,targetName:c,stream:1,streamId:a,reason:coe(e)}),t.promise}},n)}#cn(e){const t=e.streamId,n=this.sourceName,r=e.sourceName,a=this.comObj,o=this,c=this.actionHandler[e.action],i={enqueue(e,o=1,c){if(this.isCancelled)return;const i=this.desiredSize;this.desiredSize-=o,i>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:n,targetName:r,stream:4,streamId:t,chunk:e},c)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:r,stream:3,streamId:t}),delete o.streamSinks[t])},error(e){Xre(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:n,targetName:r,stream:5,streamId:t,reason:coe(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};i.sinkCapability.resolve(),i.ready=i.sinkCapability.promise,this.streamSinks[t]=i,Promise.try(c,e.data,i).then((function(){a.postMessage({sourceName:n,targetName:r,stream:8,streamId:t,success:!0})}),(function(e){a.postMessage({sourceName:n,targetName:r,stream:8,streamId:t,reason:coe(e)})}))}#on(e){const t=e.streamId,n=this.sourceName,r=e.sourceName,a=this.comObj,o=this.streamControllers[t],c=this.streamSinks[t];switch(e.stream){case 8:e.success?o.startCall.resolve():o.startCall.reject(coe(e.reason));break;case 7:e.success?o.pullCall.resolve():o.pullCall.reject(coe(e.reason));break;case 6:if(!c){a.postMessage({sourceName:n,targetName:r,stream:7,streamId:t,success:!0});break}c.desiredSize<=0&&e.desiredSize>0&&c.sinkCapability.resolve(),c.desiredSize=e.desiredSize,Promise.try(c.onPull||ooe).then((function(){a.postMessage({sourceName:n,targetName:r,stream:7,streamId:t,success:!0})}),(function(e){a.postMessage({sourceName:n,targetName:r,stream:7,streamId:t,reason:coe(e)})}));break;case 4:if(Xre(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case 3:if(Xre(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),this.#in(o,t);break;case 5:Xre(o,"error should have stream controller"),o.controller.error(coe(e.reason)),this.#in(o,t);break;case 2:e.success?o.cancelCall.resolve():o.cancelCall.reject(coe(e.reason)),this.#in(o,t);break;case 1:if(!c)break;const i=coe(e.reason);Promise.try(c.onCancel||ooe,i).then((function(){a.postMessage({sourceName:n,targetName:r,stream:2,streamId:t,success:!0})}),(function(e){a.postMessage({sourceName:n,targetName:r,stream:2,streamId:t,reason:coe(e)})})),c.sinkCapability.reject(i),c.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#in(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#rn?.abort(),this.#rn=null}}class loe{#ln=!1;constructor({enableHWA:e=!1}){this.#ln=e}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#ln})}}reset(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Kre("Abstract method `_createCanvas` called.")}}class soe{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(t).then((e=>({cMapData:e,isCompressed:this.isCompressed}))).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}async _fetch(e){Kre("Abstract method `_fetch` called.")}}class hoe extends soe{async _fetch(e){const t=await yae(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):lae(t)}}class doe{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,n,r,a){return"none"}destroy(e=!1){}}class uoe{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetch(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}async _fetch(e){Kre("Abstract method `_fetch` called.")}}class moe extends uoe{async _fetch(e){const t=await yae(e,"arraybuffer");return new Uint8Array(t)}}async function poe(e){const t=St.getBuiltinModule("fs"),n=await t.promises.readFile(e);return new Uint8Array(n)}Are&&Yre("Please use the `legacy` build in Node.js environments.");const voe="Fill",foe="Stroke",zoe="Shading";function goe(e,t){if(!t)return;const n=t[2]-t[0],r=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],n,r),e.clip(a)}class yoe{getPattern(){Kre("Abstract method `getPattern` called.")}}class Moe extends yoe{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,n,r){let a;if(r===foe||r===voe){const o=t.current.getClippedPathBoundingBox(r,Aae(e))||[0,0,0,0],c=Math.ceil(o[2]-o[0])||1,i=Math.ceil(o[3]-o[1])||1,l=t.cachedCanvases.getCanvas("pattern",c,i),s=l.context;s.clearRect(0,0,s.canvas.width,s.canvas.height),s.beginPath(),s.rect(0,0,s.canvas.width,s.canvas.height),s.translate(-o[0],-o[1]),n=uae.transform(n,[1,0,0,1,o[0],o[1]]),s.transform(...t.baseTransform),this.matrix&&s.transform(...this.matrix),goe(s,this._bbox),s.fillStyle=this._createGradient(s),s.fill(),a=e.createPattern(l.canvas,"no-repeat");const h=new DOMMatrix(n);a.setTransform(h)}else goe(e,this._bbox),a=this._createGradient(e);return a}}function Eoe(e,t,n,r,a,o,c,i){const l=t.coords,s=t.colors,h=e.data,d=4*e.width;let u;l[n+1]>l[r+1]&&(u=n,n=r,r=u,u=o,o=c,c=u),l[r+1]>l[a+1]&&(u=r,r=a,a=u,u=c,c=i,i=u),l[n+1]>l[r+1]&&(u=n,n=r,r=u,u=o,o=c,c=u);const m=(l[n]+t.offsetX)*t.scaleX,p=(l[n+1]+t.offsetY)*t.scaleY,v=(l[r]+t.offsetX)*t.scaleX,f=(l[r+1]+t.offsetY)*t.scaleY,z=(l[a]+t.offsetX)*t.scaleX,g=(l[a+1]+t.offsetY)*t.scaleY;if(p>=g)return;const y=s[o],M=s[o+1],E=s[o+2],b=s[c],H=s[c+1],V=s[c+2],C=s[i],L=s[i+1],k=s[i+2],w=Math.round(p),S=Math.round(g);let x,T,O,A,R,N,_,D;for(let e=w;e<=S;e++){if(e<f){const t=e<p?0:(p-e)/(p-f);x=m-(m-v)*t,T=y-(y-b)*t,O=M-(M-H)*t,A=E-(E-V)*t}else{let t;t=e>g?1:f===g?0:(f-e)/(f-g),x=v-(v-z)*t,T=b-(b-C)*t,O=H-(H-L)*t,A=V-(V-k)*t}let t;t=e<p?0:e>g?1:(p-e)/(p-g),R=m-(m-z)*t,N=y-(y-C)*t,_=M-(M-L)*t,D=E-(E-k)*t;const n=Math.round(Math.min(x,R)),r=Math.round(Math.max(x,R));let a=d*e+4*n;for(let e=n;e<=r;e++)t=(x-e)/(x-R),t<0?t=0:t>1&&(t=1),h[a++]=T-(T-N)*t|0,h[a++]=O-(O-_)*t|0,h[a++]=A-(A-D)*t|0,h[a++]=255}}function boe(e,t,n){const r=t.coords,a=t.colors;let o,c;switch(t.type){case"lattice":const i=t.verticesPerRow,l=Math.floor(r.length/i)-1,s=i-1;for(o=0;o<l;o++){let t=o*i;for(let o=0;o<s;o++,t++)Eoe(e,n,r[t],r[t+1],r[t+i],a[t],a[t+1],a[t+i]),Eoe(e,n,r[t+i+1],r[t+1],r[t+i],a[t+i+1],a[t+1],a[t+i])}break;case"triangles":for(o=0,c=r.length;o<c;o+=3)Eoe(e,n,r[o],r[o+1],r[o+2],a[o],a[o+1],a[o+2]);break;default:throw new Error("illegal figure")}}class Hoe extends yoe{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,n){const r=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),o=Math.ceil(this._bounds[2])-r,c=Math.ceil(this._bounds[3])-a,i=Math.min(Math.ceil(Math.abs(o*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(c*e[1]*1.1)),3e3),s=o/i,h=c/l,d={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-a,scaleX:1/s,scaleY:1/h},u=i+4,m=l+4,p=n.getCanvas("mesh",u,m),v=p.context,f=v.createImageData(i,l);if(t){const e=f.data;for(let n=0,r=e.length;n<r;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=255}for(const e of this._figures)boe(f,e,d);return v.putImageData(f,2,2),{canvas:p.canvas,offsetX:r-2*s,offsetY:a-2*h,scaleX:s,scaleY:h}}getPattern(e,t,n,r){let a;if(goe(e,this._bbox),r===zoe)a=uae.singularValueDecompose2dScale(Aae(e));else if(a=uae.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=uae.singularValueDecompose2dScale(this.matrix);a=[a[0]*e[0],a[1]*e[1]]}const o=this._createMeshCanvas(a,r===zoe?null:this._background,t.cachedCanvases);return r!==zoe&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(o.offsetX,o.offsetY),e.scale(o.scaleX,o.scaleY),e.createPattern(o.canvas,"no-repeat")}}class Voe extends yoe{getPattern(){return"hotpink"}}class Coe{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,r,a){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=n,this.canvasGraphicsFactory=r,this.baseTransform=a}createPatternCanvas(e){const{bbox:t,operatorList:n,paintType:r,tilingType:a,color:o,canvasGraphicsFactory:c}=this;let{xstep:i,ystep:l}=this;i=Math.abs(i),l=Math.abs(l),Gre("TilingType: "+a);const s=t[0],h=t[1],d=t[2],u=t[3],m=d-s,p=u-h,v=uae.singularValueDecompose2dScale(this.matrix),f=uae.singularValueDecompose2dScale(this.baseTransform),z=v[0]*f[0],g=v[1]*f[1];let y=m,M=p,E=!1,b=!1;const H=Math.ceil(i*z),V=Math.ceil(l*g);H>=Math.ceil(m*z)?y=i:E=!0,V>=Math.ceil(p*g)?M=l:b=!0;const C=this.getSizeAndScale(y,this.ctx.canvas.width,z),L=this.getSizeAndScale(M,this.ctx.canvas.height,g),k=e.cachedCanvases.getCanvas("pattern",C.size,L.size),w=k.context,S=c.createCanvasGraphics(w);if(S.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(S,r,o),w.translate(-C.scale*s,-L.scale*h),S.transform(C.scale,0,0,L.scale,0,0),w.save(),this.clipBbox(S,s,h,d,u),S.baseTransform=Aae(S.ctx),S.executeOperatorList(n),S.endDrawing(),w.restore(),E||b){const t=k.canvas;E&&(y=i),b&&(M=l);const n=this.getSizeAndScale(y,this.ctx.canvas.width,z),r=this.getSizeAndScale(M,this.ctx.canvas.height,g),a=n.size,o=r.size,c=e.cachedCanvases.getCanvas("pattern-workaround",a,o),d=c.context,u=E?Math.floor(m/i):0,v=b?Math.floor(p/l):0;for(let e=0;e<=u;e++)for(let n=0;n<=v;n++)d.drawImage(t,a*e,o*n,a,o,0,0,a,o);return{canvas:c.canvas,scaleX:n.scale,scaleY:r.scale,offsetX:s,offsetY:h}}return{canvas:k.canvas,scaleX:C.scale,scaleY:L.scale,offsetX:s,offsetY:h}}getSizeAndScale(e,t,n){const r=Math.max(Coe.MAX_PATTERN_SIZE,t);let a=Math.ceil(e*n);return a>=r?a=r:n=a/e,{scale:n,size:a}}clipBbox(e,t,n,r,a){const o=r-t,c=a-n;e.ctx.rect(t,n,o,c),e.current.updateRectMinMax(Aae(e.ctx),[t,n,r,a]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){const r=e.ctx,a=e.current;switch(t){case 1:const e=this.ctx;r.fillStyle=e.fillStyle,r.strokeStyle=e.strokeStyle,a.fillColor=e.fillStyle,a.strokeColor=e.strokeStyle;break;case 2:const o=uae.makeHexColor(n[0],n[1],n[2]);r.fillStyle=o,r.strokeStyle=o,a.fillColor=o,a.strokeColor=o;break;default:throw new oae(`Unsupported paint type: ${t}`)}}getPattern(e,t,n,r){let a=n;r!==zoe&&(a=uae.transform(a,t.baseTransform),this.matrix&&(a=uae.transform(a,this.matrix)));const o=this.createPatternCanvas(t);let c=new DOMMatrix(a);c=c.translate(o.offsetX,o.offsetY),c=c.scale(1/o.scaleX,1/o.scaleY);const i=e.createPattern(o.canvas,"repeat");return i.setTransform(c),i}}function Loe({src:e,srcPos:t=0,dest:n,width:r,height:a,nonBlackColor:o=4294967295,inverseDecode:c=!1}){const i=hae.isLittleEndian?4278190080:255,[l,s]=c?[o,i]:[i,o],h=r>>3,d=7&r,u=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r<a;r++){for(const r=t+h;t<r;t++){const r=t<u?e[t]:255;n[m++]=128&r?s:l,n[m++]=64&r?s:l,n[m++]=32&r?s:l,n[m++]=16&r?s:l,n[m++]=8&r?s:l,n[m++]=4&r?s:l,n[m++]=2&r?s:l,n[m++]=1&r?s:l}if(0===d)continue;const r=t<u?e[t++]:255;for(let e=0;e<d;e++)n[m++]=r&1<<7-e?s:l}return{srcPos:t,destPos:m}}const koe=16;class woe{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let r;return void 0!==this.cache[e]?(r=this.cache[e],this.canvasFactory.reset(r,t,n)):(r=this.canvasFactory.create(t,n),this.cache[e]=r),r}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function Soe(e,t,n,r,a,o,c,i,l,s){const[h,d,u,m,p,v]=Aae(e);if(0===d&&0===u){const f=c*h+p,z=Math.round(f),g=i*m+v,y=Math.round(g),M=(c+l)*h+p,E=Math.abs(Math.round(M)-z)||1,b=(i+s)*m+v,H=Math.abs(Math.round(b)-y)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(m),z,y),e.drawImage(t,n,r,a,o,0,0,E,H),e.setTransform(h,d,u,m,p,v),[E,H]}if(0===h&&0===m){const f=i*u+p,z=Math.round(f),g=c*d+v,y=Math.round(g),M=(i+s)*u+p,E=Math.abs(Math.round(M)-z)||1,b=(c+l)*d+v,H=Math.abs(Math.round(b)-y)||1;return e.setTransform(0,Math.sign(d),Math.sign(u),0,z,y),e.drawImage(t,n,r,a,o,0,0,H,E),e.setTransform(h,d,u,m,p,v),[H,E]}return e.drawImage(t,n,r,a,o,c,i,l,s),[Math.hypot(h,d)*l,Math.hypot(u,m)*s]}class xoe{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Rre,this.textMatrixScale=1,this.fontMatrix=Nre,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=0,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,n){[t,n]=uae.applyTransform([t,n],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(e,t){const n=uae.applyTransform(t,e),r=uae.applyTransform(t.slice(2),e),a=uae.applyTransform([t[0],t[3]],e),o=uae.applyTransform([t[2],t[1]],e);this.minX=Math.min(this.minX,n[0],r[0],a[0],o[0]),this.minY=Math.min(this.minY,n[1],r[1],a[1],o[1]),this.maxX=Math.max(this.maxX,n[0],r[0],a[0],o[0]),this.maxY=Math.max(this.maxY,n[1],r[1],a[1],o[1])}updateScalingPathMinMax(e,t){uae.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,n,r,a,o,c,i,l,s){const h=uae.bezierBoundingBox(t,n,r,a,o,c,i,l,s);s||this.updateRectMinMax(e,h)}getPathBoundingBox(e=voe,t=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(e===foe){t||Kre("Stroke bounding box must include transform.");const e=uae.singularValueDecompose2dScale(t),r=e[0]*this.lineWidth/2,a=e[1]*this.lineWidth/2;n[0]-=r,n[1]-=a,n[2]+=r,n[3]+=a}return n}updateClipFromPath(){const e=uae.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=voe,t=null){return uae.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function Toe(e,t){if(t instanceof ImageData)return void e.putImageData(t,0,0);const n=t.height,r=t.width,a=n%koe,o=(n-a)/koe,c=0===a?o:o+1,i=e.createImageData(r,koe);let l,s=0;const h=t.data,d=i.data;let u,m,p,v;if(t.kind===Bre.GRAYSCALE_1BPP){const t=h.byteLength,n=new Uint32Array(d.buffer,0,d.byteLength>>2),v=n.length,f=r+7>>3,z=4294967295,g=hae.isLittleEndian?4278190080:255;for(u=0;u<c;u++){for(p=u<o?koe:a,l=0,m=0;m<p;m++){const e=t-s;let a=0;const o=e>f?r:8*e-7,c=-8&o;let i=0,d=0;for(;a<c;a+=8)d=h[s++],n[l++]=128&d?z:g,n[l++]=64&d?z:g,n[l++]=32&d?z:g,n[l++]=16&d?z:g,n[l++]=8&d?z:g,n[l++]=4&d?z:g,n[l++]=2&d?z:g,n[l++]=1&d?z:g;for(;a<o;a++)0===i&&(d=h[s++],i=128),n[l++]=d&i?z:g,i>>=1}for(;l<v;)n[l++]=0;e.putImageData(i,0,u*koe)}}else if(t.kind===Bre.RGBA_32BPP){for(m=0,v=r*koe*4,u=0;u<o;u++)d.set(h.subarray(s,s+v)),s+=v,e.putImageData(i,0,m),m+=koe;u<c&&(v=r*a*4,d.set(h.subarray(s,s+v)),e.putImageData(i,0,m))}else{if(t.kind!==Bre.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(p=koe,v=r*p,u=0;u<c;u++){for(u>=o&&(p=a,v=r*p),l=0,m=v;m--;)d[l++]=h[s++],d[l++]=h[s++],d[l++]=h[s++],d[l++]=255;e.putImageData(i,0,u*koe)}}}function Ooe(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const n=t.height,r=t.width,a=n%koe,o=(n-a)/koe,c=0===a?o:o+1,i=e.createImageData(r,koe);let l=0;const s=t.data,h=i.data;for(let t=0;t<c;t++){const n=t<o?koe:a;({srcPos:l}=Loe({src:s,srcPos:l,dest:h,width:r,height:n,nonBlackColor:0})),e.putImageData(i,0,t*koe)}}function Aoe(e,t){const n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of n)void 0!==e[r]&&(t[r]=e[r]);void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function Roe(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0),!Are){const{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}}function Noe(e,t){if(t)return!0;const n=uae.singularValueDecompose2dScale(e);n[0]=Math.fround(n[0]),n[1]=Math.fround(n[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*gae.PDF_TO_CSS_UNITS);return n[0]<=r&&n[1]<=r}const _oe=["butt","round","square"],Doe=["miter","round","bevel"],Poe={},Foe={};class Ioe{constructor(e,t,n,r,a,{optionalContentConfig:o,markedContentStack:c=null},i,l){this.ctx=e,this.current=new xoe(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.filterFactory=a,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=c||[],this.optionalContentConfig=o,this.cachedCanvases=new woe(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=i,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:r=null}){const a=this.ctx.canvas.width,o=this.ctx.canvas.height,c=this.ctx.fillStyle;if(this.ctx.fillStyle=r||"#ffffff",this.ctx.fillRect(0,0,a,o),this.ctx.fillStyle=c,n){const e=this.cachedCanvases.getCanvas("transparent",a,o);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...Aae(this.compositeCtx))}this.ctx.save(),Roe(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=Aae(this.ctx)}executeOperatorList(e,t,n,r){const a=e.argsArray,o=e.fnArray;let c=t||0;const i=a.length;if(i===c)return c;const l=i-c>10&&"function"==typeof n,s=l?Date.now()+15:0;let h=0;const d=this.commonObjs,u=this.objs;let m;for(;;){if(void 0!==r&&c===r.nextBreakPoint)return r.breakIt(c,n),c;if(m=o[c],m!==Ure.dependency)this[m].apply(this,a[c]);else for(const e of a[c]){const t=e.startsWith("g_")?d:u;if(!t.has(e))return t.get(e,n),c}if(c++,c===i)return c;if(l&&++h>10){if(Date.now()>s)return n(),c;h=0}}}#sn(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#sn(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#hn()}#hn(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){const n=e.width??e.displayWidth,r=e.height??e.displayHeight;let a,o,c=Math.max(Math.hypot(t[0],t[1]),1),i=Math.max(Math.hypot(t[2],t[3]),1),l=n,s=r,h="prescale1";for(;c>2&&l>1||i>2&&s>1;){let t=l,n=s;c>2&&l>1&&(t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),c/=l/t),i>2&&s>1&&(n=s>=16384?Math.floor(s/2)-1||1:Math.ceil(s)/2,i/=s/n),a=this.cachedCanvases.getCanvas(h,t,n),o=a.context,o.clearRect(0,0,t,n),o.drawImage(e,0,0,l,s,0,0,t,n),e=a.canvas,l=t,s=n,h="prescale1"===h?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:s}}_createMaskCanvas(e){const t=this.ctx,{width:n,height:r}=e,a=this.current.fillColor,o=this.current.patternFill,c=Aae(t);let i,l,s,h;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;l=JSON.stringify(o?c:[c.slice(0,4),a]),i=this._cachedBitmapsMap.get(t),i||(i=new Map,this._cachedBitmapsMap.set(t,i));const n=i.get(l);if(n&&!o)return{canvas:n,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])};s=n}s||(h=this.cachedCanvases.getCanvas("maskCanvas",n,r),Ooe(h.context,e));let d=uae.transform(c,[1/n,0,0,-1/r,0,0]);d=uae.transform(d,[1,0,0,1,0,-r]);const[u,m,p,v]=uae.getAxialAlignedBoundingBox([0,0,n,r],d),f=Math.round(p-u)||1,z=Math.round(v-m)||1,g=this.cachedCanvases.getCanvas("fillCanvas",f,z),y=g.context,M=u,E=m;y.translate(-M,-E),y.transform(...d),s||(s=this._scaleImage(h.canvas,Rae(y)),s=s.img,i&&o&&i.set(l,s)),y.imageSmoothingEnabled=Noe(Aae(y),e.interpolate),Soe(y,s,0,0,s.width,s.height,0,0,n,r),y.globalCompositeOperation="source-in";const b=uae.transform(Rae(y),[1,0,0,1,-M,-E]);return y.fillStyle=o?a.getPattern(t,this,b,voe):a,y.fillRect(0,0,n,r),i&&!o&&(this.cachedCanvases.delete("fillCanvas"),i.set(l,g.canvas)),{canvas:g.canvas,offsetX:Math.round(M),offsetY:Math.round(E)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=_oe[e]}setLineJoin(e){this.ctx.lineJoin=Doe[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const n=this.ctx;void 0!==n.setLineDash&&(n.setLineDash(e),n.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,n]of e)switch(t){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx,this.ctx=r.context;const a=this.ctx;a.setTransform(...Aae(this.suspendedCtx)),Aoe(this.suspendedCtx,a),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},e.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},e.transform=function(e,n,r,a,o,c){t.transform(e,n,r,a,o,c),this.__originalTransform(e,n,r,a,o,c)},e.setTransform=function(e,n,r,a,o,c){t.setTransform(e,n,r,a,o,c),this.__originalSetTransform(e,n,r,a,o,c)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},e.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},e.bezierCurveTo=function(e,n,r,a,o,c){t.bezierCurveTo(e,n,r,a,o,c),this.__originalBezierCurveTo(e,n,r,a,o,c)},e.rect=function(e,n,r,a){t.rect(e,n,r,a),this.__originalRect(e,n,r,a)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(a,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Aoe(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,n,r){const a=r[0],o=r[1],c=r[2]-a,i=r[3]-o;0!==c&&0!==i&&(this.genericComposeSMask(t.context,n,c,i,t.subtype,t.backdrop,t.transferMap,a,o,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}genericComposeSMask(e,t,n,r,a,o,c,i,l,s,h){let d=e.canvas,u=i-s,m=l-h;if(o){const t=uae.makeHexColor(...o);if(u<0||m<0||u+n>d.width||m+r>d.height){const e=this.cachedCanvases.getCanvas("maskExtension",n,r),a=e.context;a.drawImage(d,-u,-m),a.globalCompositeOperation="destination-atop",a.fillStyle=t,a.fillRect(0,0,n,r),a.globalCompositeOperation="source-over",d=e.canvas,u=m=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const a=new Path2D;a.rect(u,m,n,r),e.clip(a),e.globalCompositeOperation="destination-atop",e.fillStyle=t,e.fillRect(u,m,n,r),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),"Alpha"===a&&c?t.filter=this.filterFactory.addAlphaFilter(c):"Luminosity"===a&&(t.filter=this.filterFactory.addLuminosityFilter(c));const p=new Path2D;p.rect(i,l,n,r),t.clip(p),t.globalCompositeOperation="destination-in",t.drawImage(d,u,m,n,r,i,l,n,r),t.restore()}save(){this.inSMaskMode?(Aoe(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Aoe(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,n,r,a,o){this.ctx.transform(e,t,n,r,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n){const r=this.ctx,a=this.current;let o,c,i=a.x,l=a.y;const s=Aae(r),h=0===s[0]&&0===s[3]||0===s[1]&&0===s[2],d=h?n.slice(0):null;for(let n=0,u=0,m=e.length;n<m;n++)switch(0|e[n]){case Ure.rectangle:i=t[u++],l=t[u++];const e=t[u++],n=t[u++],m=i+e,p=l+n;r.moveTo(i,l),0===e||0===n?r.lineTo(m,p):(r.lineTo(m,l),r.lineTo(m,p),r.lineTo(i,p)),h||a.updateRectMinMax(s,[i,l,m,p]),r.closePath();break;case Ure.moveTo:i=t[u++],l=t[u++],r.moveTo(i,l),h||a.updatePathMinMax(s,i,l);break;case Ure.lineTo:i=t[u++],l=t[u++],r.lineTo(i,l),h||a.updatePathMinMax(s,i,l);break;case Ure.curveTo:o=i,c=l,i=t[u+4],l=t[u+5],r.bezierCurveTo(t[u],t[u+1],t[u+2],t[u+3],i,l),a.updateCurvePathMinMax(s,o,c,t[u],t[u+1],t[u+2],t[u+3],i,l,d),u+=6;break;case Ure.curveTo2:o=i,c=l,r.bezierCurveTo(i,l,t[u],t[u+1],t[u+2],t[u+3]),a.updateCurvePathMinMax(s,o,c,i,l,t[u],t[u+1],t[u+2],t[u+3],d),i=t[u+2],l=t[u+3],u+=4;break;case Ure.curveTo3:o=i,c=l,i=t[u+2],l=t[u+3],r.bezierCurveTo(t[u],t[u+1],i,l,i,l),a.updateCurvePathMinMax(s,o,c,t[u],t[u+1],i,l,i,l,d),u+=4;break;case Ure.closePath:r.closePath()}h&&a.updateScalingPathMinMax(s,d),a.setCurrentPoint(i,l)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof n&&n?.getPattern?(t.save(),t.strokeStyle=n.getPattern(t,this,Rae(t),foe),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,n=this.current.fillColor;let r=!1;this.current.patternFill&&(t.save(),t.fillStyle=n.getPattern(t,this,Rae(t),voe),r=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),r&&t.restore(),e&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=Poe}eoClip(){this.pendingClip=Foe}beginText(){this.current.textMatrix=Rre,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0===e)return void t.beginPath();const n=new Path2D,r=t.getTransform().invertSelf();for(const{transform:t,x:a,y:o,fontSize:c,path:i}of e)n.addPath(i,new DOMMatrix(t).preMultiplySelf(r).translate(a,o).scale(c,-c));t.clip(n),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const n=this.commonObjs.get(e),r=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(r.fontMatrix=n.fontMatrix||Nre,0!==r.fontMatrix[0]&&0!==r.fontMatrix[3]||Yre("Invalid font matrix for font "+e),t<0?(t=-t,r.fontDirection=-1):r.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;const a=n.loadedName||"sans-serif",o=n.systemFontInfo?.css||`"${a}", ${n.fallbackName}`;let c="normal";n.black?c="900":n.bold&&(c="bold");const i=n.italic?"italic":"normal";let l=t;t<16?l=16:t>100&&(l=100),this.current.fontSizeScale=t/l,this.ctx.font=`${i} ${c} ${l}px ${o}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,n,r,a,o){this.current.textMatrix=[e,t,n,r,a,o],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}#dn(e,t,n){const r=new Path2D;return r.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),r}paintChar(e,t,n,r,a){const o=this.ctx,c=this.current,i=c.font,l=c.textRenderingMode,s=c.fontSize/c.fontSizeScale,h=3&l,d=!!(4&l),u=c.patternFill&&!i.missingFile,m=c.patternStroke&&!i.missingFile;let p;if((i.disableFontFace||d||u||m)&&(p=i.getPathGenerator(this.commonObjs,e)),i.disableFontFace||u||m){if(o.save(),o.translate(t,n),o.scale(s,-s),0===h||2===h)if(r){const e=o.getTransform();o.setTransform(...r),o.fill(this.#dn(p,e,r))}else o.fill(p);if(1===h||2===h)if(a){const e=o.getTransform();o.setTransform(...a),o.stroke(this.#dn(p,e,a))}else o.lineWidth/=s,o.stroke(p);o.restore()}else 0!==h&&2!==h||o.fillText(e,t,n),1!==h&&2!==h||o.strokeText(e,t,n);d&&(this.pendingTextPaths||=[]).push({transform:Aae(o),x:t,y:n,fontSize:s,path:p})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let n=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){n=!0;break}return Jre(this,"isFontSubpixelAAEnabled",n)}showText(e){const t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);const r=t.fontSize;if(0===r)return;const a=this.ctx,o=t.fontSizeScale,c=t.charSpacing,i=t.wordSpacing,l=t.fontDirection,s=t.textHScale*l,h=e.length,d=n.vertical,u=d?1:-1,m=n.defaultVMetrics,p=r*t.fontMatrix[0],v=0===t.textRenderingMode&&!n.disableFontFace&&!t.patternFill;let f,z;if(a.save(),a.transform(...t.textMatrix),a.translate(t.x,t.y+t.textRise),l>0?a.scale(s,-1):a.scale(s,1),t.patternFill){a.save();const e=t.fillColor.getPattern(a,this,Rae(a),voe);f=Aae(a),a.restore(),a.fillStyle=e}if(t.patternStroke){a.save();const e=t.strokeColor.getPattern(a,this,Rae(a),foe);z=Aae(a),a.restore(),a.strokeStyle=e}let g=t.lineWidth;const y=t.textMatrixScale;if(0===y||0===g){const e=3&t.textRenderingMode;1!==e&&2!==e||(g=this.getSinglePixelWidth())}else g/=y;if(1!==o&&(a.scale(o,o),g/=o),a.lineWidth=g,n.isInvalidPDFjsFont){const n=[];let r=0;for(const t of e)n.push(t.unicode),r+=t.width;return a.fillText(n.join(""),0,0),t.x+=r*p*s,a.restore(),void this.compose()}let M,E=0;for(M=0;M<h;++M){const t=e[M];if("number"==typeof t){E+=u*t*r/1e3;continue}let s=!1;const h=(t.isSpace?i:0)+c,g=t.fontChar,y=t.accent;let b,H,V=t.width;if(d){const e=t.vmetric||m,n=-(t.vmetric?e[1]:.5*V)*p,r=e[2]*p;V=e?-e[0]:V,b=n/o,H=(E+r)/o}else b=E/o,H=0;if(n.remeasure&&V>0){const e=1e3*a.measureText(g).width/r*o;if(V<e&&this.isFontSubpixelAAEnabled){const t=V/e;s=!0,a.save(),a.scale(t,1),b/=t}else V!==e&&(b+=(V-e)/2e3*r/o)}if(this.contentVisible&&(t.isInFont||n.missingFile))if(v&&!y)a.fillText(g,b,H);else if(this.paintChar(g,b,H,f,z),y){const e=b+r*y.offset.x/o,t=H-r*y.offset.y/o;this.paintChar(y.fontChar,e,t,f,z)}E+=d?V*p-h*l:V*p+h*l,s&&a.restore()}d?t.y-=E:t.x+=E*s,a.restore(),this.compose()}showType3Text(e){const t=this.ctx,n=this.current,r=n.font,a=n.fontSize,o=n.fontDirection,c=r.vertical?1:-1,i=n.charSpacing,l=n.wordSpacing,s=n.textHScale*o,h=n.fontMatrix||Nre,d=e.length;let u,m,p,v;if(3!==n.textRenderingMode&&0!==a){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...n.textMatrix),t.translate(n.x,n.y),t.scale(s,o),u=0;u<d;++u){if(m=e[u],"number"==typeof m){v=c*m*a/1e3,this.ctx.translate(v,0),n.x+=v*s;continue}const o=(m.isSpace?l:0)+i,d=r.charProcOperatorList[m.operatorListId];d?(this.contentVisible&&(this.processingType3=m,this.save(),t.scale(a,a),t.transform(...h),this.executeOperatorList(d),this.restore()),p=uae.applyTransform([m.width,0],h)[0]*a+o,t.translate(p,0),n.x+=p*s):Yre(`Type3 character "${m.operatorListId}" is not available.`)}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,n,r,a,o){this.ctx.rect(n,r,a-n,o-r),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const n=e[1],r=this.baseTransform||Aae(this.ctx),a={createCanvasGraphics:e=>new Ioe(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new Coe(e,n,this.ctx,a,r)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,n){this.ctx.strokeStyle=this.current.strokeColor=uae.makeHexColor(e,t,n),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t,n){this.ctx.fillStyle=this.current.fillColor=uae.makeHexColor(e,t,n),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,t=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=function(e){switch(e[0]){case"RadialAxial":return new Moe(e);case"Mesh":return new Hoe(e);case"Dummy":return new Voe}throw new Error(`Unknown IR type: ${e[0]}`)}(this.getObject(e)),this.cachedPatterns.set(e,n)),t&&(n.matrix=t),n}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const n=this._getPattern(e);t.fillStyle=n.getPattern(t,this,Rae(t),zoe);const r=Rae(t);if(r){const{width:e,height:n}=t.canvas,[a,o,c,i]=uae.getAxialAlignedBoundingBox([0,0,e,n],r);this.ctx.fillRect(a,o,c-a,i-o)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Kre("Should not call beginInlineImage")}beginImageData(){Kre("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=Aae(this.ctx),t)){const e=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],e,n),this.current.updateRectMinMax(Aae(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||Gre("TODO: Support non-isolated groups."),e.knockout&&Yre("Knockout groups not supported.");const n=Aae(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=uae.getAxialAlignedBoundingBox(e.bbox,Aae(t));const a=[0,0,t.canvas.width,t.canvas.height];r=uae.intersect(r,a)||[0,0,0,0];const o=Math.floor(r[0]),c=Math.floor(r[1]),i=Math.max(Math.ceil(r[2])-o,1),l=Math.max(Math.ceil(r[3])-c,1);this.current.startNewPathAndClipBox([0,0,i,l]);let s="groupAt"+this.groupLevel;e.smask&&(s+="_smask_"+this.smaskCounter++%2);const h=this.cachedCanvases.getCanvas(s,i,l),d=h.context;d.translate(-o,-c),d.transform(...n),e.smask?this.smaskStack.push({canvas:h.canvas,context:d,offsetX:o,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,c),t.save()),Aoe(t,d),this.ctx=d,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=Aae(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const n=uae.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,t,n,r,a){if(this.#sn(),Roe(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const r=t[2]-t[0],o=t[3]-t[1];if(a&&this.annotationCanvasMap){(n=n.slice())[4]-=t[0],n[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=r,t[3]=o;const[a,c]=uae.singularValueDecompose2dScale(Aae(this.ctx)),{viewportScale:i}=this,l=Math.ceil(r*this.outputScaleX*i),s=Math.ceil(o*this.outputScaleY*i);this.annotationCanvas=this.canvasFactory.create(l,s);const{canvas:h,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(e,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.save(),this.ctx.setTransform(a,0,0,-c,0,o*c),Roe(this.ctx)}else Roe(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],r,o),this.ctx.clip(),this.ctx.beginPath()}this.current=new xoe(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...r)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#hn(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const n=this.ctx,r=this.processingType3;if(r&&(void 0===r.compiled&&(r.compiled=function(e){const{width:t,height:n}=e;if(t>1e3||n>1e3)return null;const r=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),a=t+1;let o,c,i,l=new Uint8Array(a*(n+1));const s=t+7&-8;let h=new Uint8Array(s*n),d=0;for(const t of e.data){let e=128;for(;e>0;)h[d++]=t&e?0:255,e>>=1}let u=0;for(d=0,0!==h[d]&&(l[0]=1,++u),c=1;c<t;c++)h[d]!==h[d+1]&&(l[c]=h[d]?2:1,++u),d++;for(0!==h[d]&&(l[c]=2,++u),o=1;o<n;o++){d=o*s,i=o*a,h[d-s]!==h[d]&&(l[i]=h[d]?1:8,++u);let e=(h[d]?4:0)+(h[d-s]?8:0);for(c=1;c<t;c++)e=(e>>2)+(h[d+1]?4:0)+(h[d-s+1]?8:0),r[e]&&(l[i+c]=r[e],++u),d++;if(h[d-s]!==h[d]&&(l[i+c]=h[d]?2:4,++u),u>1e3)return null}for(d=s*(n-1),i=o*a,0!==h[d]&&(l[i]=8,++u),c=1;c<t;c++)h[d]!==h[d+1]&&(l[i+c]=h[d]?4:8,++u),d++;if(0!==h[d]&&(l[i+c]=4,++u),u>1e3)return null;const m=new Int32Array([0,a,-1,0,-a,0,0,0,1]),p=new Path2D;for(o=0;u&&o<=n;o++){let e=o*a;const n=e+t;for(;e<n&&!l[e];)e++;if(e===n)continue;p.moveTo(e%a,o);const r=e;let c=l[e];do{const t=m[c];do{e+=t}while(!l[e]);const n=l[e];5!==n&&10!==n?(c=n,l[e]=0):(c=n&51*c>>4,l[e]&=c>>2|c<<2),p.lineTo(e%a,e/a|0),l[e]||--u}while(r!==e);--o}return h=null,l=null,function(e){e.save(),e.scale(1/t,-1/n),e.translate(0,-n),e.fill(p),e.beginPath(),e.restore()}}(e)),r.compiled))return void r.compiled(n);const a=this._createMaskCanvas(e),o=a.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(o,a.offsetX,a.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n=0,r=0,a,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const c=this.ctx;c.save();const i=Aae(c);c.transform(t,n,r,a,0,0);const l=this._createMaskCanvas(e);c.setTransform(1,0,0,1,l.offsetX-i[4],l.offsetY-i[5]);for(let e=0,s=o.length;e<s;e+=2){const s=uae.transform(i,[t,n,r,a,o[e],o[e+1]]),[h,d]=uae.applyTransform([0,0],s);c.drawImage(l.canvas,h,d)}c.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,n=this.current.fillColor,r=this.current.patternFill;for(const a of e){const{data:e,width:o,height:c,transform:i}=a,l=this.cachedCanvases.getCanvas("maskCanvas",o,c),s=l.context;s.save(),Ooe(s,this.getObject(e,a)),s.globalCompositeOperation="source-in",s.fillStyle=r?n.getPattern(s,this,Rae(t),voe):n,s.fillRect(0,0,o,c),s.restore(),t.save(),t.transform(...i),t.scale(1,-1),Soe(t,l.canvas,0,0,o,c,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):Yre("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,n,r){if(!this.contentVisible)return;const a=this.getObject(e);if(!a)return void Yre("Dependent image isn't ready yet");const o=a.width,c=a.height,i=[];for(let e=0,a=r.length;e<a;e+=2)i.push({transform:[t,0,0,n,r[e],r[e+1]],x:0,y:0,w:o,h:c});this.paintInlineImageXObjectGroup(a,i)}applyTransferMapsToCanvas(e){return"none"!==this.current.transferMaps&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:n,height:r}=e,a=this.cachedCanvases.getCanvas("inlineImage",n,r),o=a.context;return o.filter=this.current.transferMaps,o.drawImage(t,0,0),o.filter="none",a.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,n=e.height,r=this.ctx;if(this.save(),!Are){const{filter:e}=r;"none"!==e&&""!==e&&(r.filter="none")}let a;if(r.scale(1/t,-1/n),e.bitmap)a=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)a=e;else{const r=this.cachedCanvases.getCanvas("inlineImage",t,n).context;Toe(r,e),a=this.applyTransferMapsToCanvas(r)}const o=this._scaleImage(a,Rae(r));r.imageSmoothingEnabled=Noe(Aae(r),e.interpolate),Soe(r,o.img,0,0,o.paintWidth,o.paintHeight,0,-n,t,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const n=this.ctx;let r;if(e.bitmap)r=e.bitmap;else{const t=e.width,n=e.height,a=this.cachedCanvases.getCanvas("inlineImage",t,n).context;Toe(a,e),r=this.applyTransferMapsToCanvas(a)}for(const e of t)n.save(),n.transform(...e.transform),n.scale(1,-1),Soe(n,r,e.x,e.y,e.w,e.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const n=this.ctx;this.pendingClip&&(t||(this.pendingClip===Foe?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Aae(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:n,c:r,d:a}=this.ctx.getTransform();let o,c;if(0===n&&0===r){const n=Math.abs(t),r=Math.abs(a);if(n===r)if(0===e)o=c=1/n;else{const t=n*e;o=c=t<1?1/t:1}else if(0===e)o=1/n,c=1/r;else{const t=n*e,a=r*e;o=t<1?1/t:1,c=a<1?1/a:1}}else{const i=Math.abs(t*a-n*r),l=Math.hypot(t,n),s=Math.hypot(r,a);if(0===e)o=s/i,c=l/i;else{const t=e*i;o=s>t?s/t:1,c=l>t?l/t:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=c}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:n}=this.current,[r,a]=this.getScaleForStroking();if(t.lineWidth=n||1,1===r&&1===a)return void t.stroke();const o=t.getLineDash();if(e&&t.save(),t.scale(r,a),o.length>0){const e=Math.max(r,a);t.setLineDash(o.map((t=>t/e))),t.lineDashOffset/=e}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const e in Ure)void 0!==Ioe.prototype[e]&&(Ioe.prototype[Ure[e]]=Ioe.prototype[e]);class Boe{static#un=null;static#mn="";static get workerPort(){return this.#un}static set workerPort(e){if(!("undefined"!=typeof Worker&&e instanceof Worker)&&null!==e)throw new Error("Invalid `workerPort` type.");this.#un=e}static get workerSrc(){return this.#mn}static set workerSrc(e){if("string"!=typeof e)throw new Error("Invalid `workerSrc` type.");this.#mn=e}}class joe{#pn;#vn;constructor({parsedData:e,rawData:t}){this.#pn=e,this.#vn=t}getRaw(){return this.#vn}get(e){return this.#pn.get(e)??null}getAll(){return sae(this.#pn)}has(e){return this.#pn.has(e)}}const Uoe=Symbol("INTERNAL");class Woe{#fn=!1;#zn=!1;#gn=!1;#yn=!0;constructor(e,{name:t,intent:n,usage:r,rbGroups:a}){this.#fn=!!(2&e),this.#zn=!!(4&e),this.name=t,this.intent=n,this.usage=r,this.rbGroups=a}get visible(){if(this.#gn)return this.#yn;if(!this.#yn)return!1;const{print:e,view:t}=this.usage;return this.#fn?"OFF"!==t?.viewState:!this.#zn||"OFF"!==e?.printState}_setVisible(e,t,n=!1){e!==Uoe&&Kre("Internal method `_setVisible` called."),this.#gn=n,this.#yn=t}}class $oe{#Mn=null;#En=new Map;#bn=null;#Hn=null;constructor(e,t=2){if(this.renderingIntent=t,this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#Hn=e.order;for(const n of e.groups)this.#En.set(n.id,new Woe(t,n));if("OFF"===e.baseState)for(const e of this.#En.values())e._setVisible(Uoe,!1);for(const t of e.on)this.#En.get(t)._setVisible(Uoe,!0);for(const t of e.off)this.#En.get(t)._setVisible(Uoe,!1);this.#bn=this.getHash()}}#Vn(e){const t=e.length;if(t<2)return!0;const n=e[0];for(let r=1;r<t;r++){const t=e[r];let a;if(Array.isArray(t))a=this.#Vn(t);else{if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;a=this.#En.get(t).visible}switch(n){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return"And"===n}isVisible(e){if(0===this.#En.size)return!0;if(!e)return Gre("Optional content group not defined."),!0;if("OCG"===e.type)return this.#En.has(e.id)?this.#En.get(e.id).visible:(Yre(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#Vn(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;if(this.#En.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;if(!this.#En.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;if(!this.#En.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#En.has(t))return Yre(`Optional content group not found: ${t}`),!0;if(this.#En.get(t).visible)return!1}return!0}return Yre(`Unknown optional content policy ${e.policy}.`),!0}return Yre(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){const r=this.#En.get(e);if(r){if(n&&t&&r.rbGroups.length)for(const t of r.rbGroups)for(const n of t)n!==e&&this.#En.get(n)?._setVisible(Uoe,!1,!0);r._setVisible(Uoe,!!t,!0),this.#Mn=null}else Yre(`Optional content group not found: ${e}`)}setOCGState({state:e,preserveRB:t}){let n;for(const r of e){switch(r){case"ON":case"OFF":case"Toggle":n=r;continue}const e=this.#En.get(r);if(e)switch(n){case"ON":this.setVisibility(r,!0,t);break;case"OFF":this.setVisibility(r,!1,t);break;case"Toggle":this.setVisibility(r,!e.visible,t)}}this.#Mn=null}get hasInitialVisibility(){return null===this.#bn||this.getHash()===this.#bn}getOrder(){return this.#En.size?this.#Hn?this.#Hn.slice():[...this.#En.keys()]:null}getGroups(){return this.#En.size>0?sae(this.#En):null}getGroup(e){return this.#En.get(e)||null}getHash(){if(null!==this.#Mn)return this.#Mn;const e=new Zae;for(const[t,n]of this.#En)e.update(`${t}:${n.visible}`);return this.#Mn=e.hexdigest()}}class qoe{constructor(e,{disableRange:t=!1,disableStream:n=!1}){Xre(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:r,initialData:a,progressiveDone:o,contentDispositionFilename:c}=e;if(this._queuedChunks=[],this._progressiveDone=o,this._contentDispositionFilename=c,a?.length>0){const e=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!n,this._isRangeSupported=!t,this._contentLength=r,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),e.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),e.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),e.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const n=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;void 0===e?this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n):Xre(this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(n),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){Xre(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new Goe(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new Yoe(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}class Goe{constructor(e,t,n=!1,r=null){this._stream=e,this._done=n||!1,this._filename=Hae(r)?r:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Yoe{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Koe(e,t){const n=new Headers;if(!e||!t||"object"!=typeof t)return n;for(const e in t){const r=t[e];void 0!==r&&n.append(e,r)}return n}function Xoe(e){try{return new URL(e).origin}catch{}return null}function Qoe({responseHeaders:e,isHttp:t,rangeChunkSize:n,disableRange:r}){const a={allowRangeRequests:!1,suggestedLength:void 0},o=parseInt(e.get("Content-Length"),10);return Number.isInteger(o)?(a.suggestedLength=o,o<=2*n||r||!t||"bytes"!==e.get("Accept-Ranges")||"identity"!==(e.get("Content-Encoding")||"identity")||(a.allowRangeRequests=!0),a):a}function Joe(e){const t=e.get("Content-Disposition");if(t){let e=function(e){let t=!0,n=r("filename\\*","i").exec(e);if(n){n=n[1];let e=c(n);return e=unescape(e),e=i(e),e=l(e),o(e)}if(n=function(e){const t=[];let n;const a=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(n=a.exec(e));){let[,e,r,a]=n;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[r,a]}const o=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=c(r),n&&(r=unescape(r),0===e&&(r=i(r))),o.push(r)}return o.join("")}(e),n)return o(l(n));if(n=r("filename","i").exec(e),n){n=n[1];let e=c(n);return e=l(e),o(e)}function r(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function a(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{const r=new TextDecoder(e,{fatal:!0}),a=lae(n);n=r.decode(a),t=!1}catch{}}return n}function o(e){return t&&/[\x80-\xff]/.test(e)&&(e=a("utf-8",e),t&&(e=a("iso-8859-1",e))),e}function c(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const n=t[e].indexOf('"');-1!==n&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,"$1")}e=t.join('"')}return e}function i(e){const t=e.indexOf("'");return-1===t?e:a(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function l(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,n,r){if("q"===n||"Q"===n)return a(t,r=(r=r.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})));try{r=atob(r)}catch{}return a(t,r)}))}return""}(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Hae(e))return e}return null}function Zoe(e,t){return 404===e||0===e&&t.startsWith("file:")?new rae('Missing PDF "'+t+'".'):new aae(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function ece(e){return 200===e||206===e}function tce(e,t,n){return{method:"GET",headers:e,signal:n.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function nce(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(Yre(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class rce{_responseOrigin=null;constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=Koe(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Xre(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new ace(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new oce(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class ace{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;const n=new Headers(e.headers),r=t.url;fetch(r,tce(n,this._withCredentials,this._abortController)).then((t=>{if(e._responseOrigin=Xoe(t.url),!ece(t.status))throw Zoe(t.status,r);this._reader=t.body.getReader(),this._headersCapability.resolve();const n=t.headers,{allowRangeRequests:a,suggestedLength:o}=Qoe({responseHeaders:n,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=Joe(n),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new cae("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:nce(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class oce{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;const r=e.source;this._withCredentials=r.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!r.disableStream,this._abortController=new AbortController;const a=new Headers(e.headers);a.append("Range",`bytes=${t}-${n-1}`);const o=r.url;fetch(o,tce(a,this._withCredentials,this._abortController)).then((t=>{const n=Xoe(t.url);if(n!==e._responseOrigin)throw new Error(`Expected range response-origin "${n}" to match "${e._responseOrigin}".`);if(!ece(t.status))throw Zoe(t.status,o);this._readCapability.resolve(),this._reader=t.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:nce(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class cce{_responseOrigin=null;constructor({url:e,httpHeaders:t,withCredentials:n}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=Koe(this.isHttp,t),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){const t=new XMLHttpRequest,n=this.currXhrId++,r=this.pendingRequests[n]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const[e,n]of this.headers)t.setRequestHeader(e,n);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),r.expectedStatus=206):r.expectedStatus=200,t.responseType="arraybuffer",Xre(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{e.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){const n=this.pendingRequests[e];n&&n.onProgress?.(t)}onStateChange(e,t){const n=this.pendingRequests[e];if(!n)return;const r=n.xhr;if(r.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4!==r.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===r.status&&this.isHttp)return void n.onError(r.status);const a=r.status||200;if((200!==a||206!==n.expectedStatus)&&a!==n.expectedStatus)return void n.onError(r.status);const o=function(e){const t=e.response;return"string"!=typeof t?t:lae(t).buffer}(r);if(206===a){const e=r.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);t?n.onDone({begin:parseInt(t[1],10),chunk:o}):(Yre('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone({begin:0,chunk:o}):n.onError(r.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class ice{constructor(e){this._source=e,this._manager=new cce(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return Xre(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new lce(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const n=new sce(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class lce{constructor(e,t){this._manager=e,this._url=t.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=Xoe(t.responseURL);const n=t.getAllResponseHeaders(),r=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map((e=>{const[t,...n]=e.split(": ");return[t,n.join(": ")]})):[]),{allowRangeRequests:a,suggestedLength:o}=Qoe({responseHeaders:r,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=Joe(r),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Zoe(e,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class sce{constructor(e,t,n){this._manager=e,this._url=e.url,this._requestId=e.request({begin:t,end:n,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){const e=Xoe(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError??=Zoe(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const hce=/^[a-z][a-z0-9\-+.]+:/i;class dce{constructor(e){this.source=e,this.url=function(e){if(hce.test(e))return new URL(e);const t=St.getBuiltinModule("url");return new URL(t.pathToFileURL(e))}(e.url),Xre("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Xre(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new uce(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new mce(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class uce{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const n=St.getBuiltinModule("fs");n.promises.lstat(this._url).then((e=>{this._contentLength=e.size,this._setReadableStream(n.createReadStream(this._url)),this._headersCapability.resolve()}),(e=>{"ENOENT"===e.code&&(e=new rae(`Missing PDF "${this._url}".`)),this._storedError=e,this._headersCapability.reject(e)}))}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new cae("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class mce{constructor(e,t,n){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const r=e.source;this._isStreamingSupported=!r.disableStream;const a=St.getBuiltinModule("fs");this._setReadableStream(a.createReadStream(this._url,{start:t,end:n-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}const pce=30;class vce{#Cn=Promise.withResolvers();#me=null;#Ln=!1;#kn=!!globalThis.FontInspector?.enabled;#wn=null;#Sn=null;#xn=0;#Tn=0;#On=null;#An=null;#Rn=0;#Nn=0;#_n=Object.create(null);#Dn=[];#Pn=null;#Fn=[];#In=new WeakMap;#Bn=null;static#jn=new Map;static#Un=new Map;static#Wn=new WeakMap;static#$n=null;static#qn=new Set;constructor({textContentSource:e,container:t,viewport:n}){if(e instanceof ReadableStream)this.#Pn=e;else{if("object"!=typeof e)throw new Error('No "textContentSource" parameter specified.');this.#Pn=new ReadableStream({start(t){t.enqueue(e),t.close()}})}this.#me=this.#An=t,this.#Nn=n.scale*(globalThis.devicePixelRatio||1),this.#Rn=n.rotation,this.#Sn={div:null,properties:null,ctx:null};const{pageWidth:r,pageHeight:a,pageX:o,pageY:c}=n.rawDims;this.#Bn=[1,0,0,-1,-o,c+a],this.#Tn=r,this.#xn=a,vce.#Gn(),Nae(t,n),this.#Cn.promise.finally((()=>{vce.#qn.delete(this),this.#Sn=null,this.#_n=null})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=hae.platform;return Jre(this,"fontFamilyMap",new Map([["sans-serif",(e&&t?"Calibri, ":"")+"sans-serif"],["monospace",(e&&t?"Lucida Console, ":"")+"monospace"]]))}render(){const e=()=>{this.#On.read().then((({value:t,done:n})=>{n?this.#Cn.resolve():(this.#wn??=t.lang,Object.assign(this.#_n,t.styles),this.#Yn(t.items),e())}),this.#Cn.reject)};return this.#On=this.#Pn.getReader(),vce.#qn.add(this),e(),this.#Cn.promise}update({viewport:e,onBefore:t=null}){const n=e.scale*(globalThis.devicePixelRatio||1),r=e.rotation;if(r!==this.#Rn&&(t?.(),this.#Rn=r,Nae(this.#An,{rotation:r})),n!==this.#Nn){t?.(),this.#Nn=n;const e={div:null,properties:null,ctx:vce.#Kn(this.#wn)};for(const t of this.#Fn)e.properties=this.#In.get(t),e.div=t,this.#Xn(e)}}cancel(){const e=new cae("TextLayer task cancelled.");this.#On?.cancel(e).catch((()=>{})),this.#On=null,this.#Cn.reject(e)}get textDivs(){return this.#Fn}get textContentItemsStr(){return this.#Dn}#Yn(e){if(this.#Ln)return;this.#Sn.ctx??=vce.#Kn(this.#wn);const t=this.#Fn,n=this.#Dn;for(const r of e){if(t.length>1e5)return Yre("Ignoring additional textDivs for performance reasons."),void(this.#Ln=!0);if(void 0!==r.str)n.push(r.str),this.#Qn(r);else if("beginMarkedContentProps"===r.type||"beginMarkedContent"===r.type){const e=this.#me;this.#me=document.createElement("span"),this.#me.classList.add("markedContent"),null!==r.id&&this.#me.setAttribute("id",`${r.id}`),e.append(this.#me)}else"endMarkedContent"===r.type&&(this.#me=this.#me.parentNode)}}#Qn(e){const t=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};this.#Fn.push(t);const r=uae.transform(this.#Bn,e.transform);let a=Math.atan2(r[1],r[0]);const o=this.#_n[e.fontName];o.vertical&&(a+=Math.PI/2);let c=this.#kn&&o.fontSubstitution||o.fontFamily;c=vce.fontFamilyMap.get(c)||c;const i=Math.hypot(r[2],r[3]),l=i*vce.#Jn(c,this.#wn);let s,h;0===a?(s=r[4],h=r[5]-l):(s=r[4]+l*Math.sin(a),h=r[5]-l*Math.cos(a));const d="calc(var(--scale-factor)*",u=t.style;this.#me===this.#An?(u.left=`${(100*s/this.#Tn).toFixed(2)}%`,u.top=`${(100*h/this.#xn).toFixed(2)}%`):(u.left=`${d}${s.toFixed(2)}px)`,u.top=`${d}${h.toFixed(2)}px)`),u.fontSize=`${d}${(vce.#$n*i).toFixed(2)}px)`,u.fontFamily=c,n.fontSize=i,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,this.#kn&&(t.dataset.fontName=o.fontSubstitutionLoadedName||e.fontName),0!==a&&(n.angle=a*(180/Math.PI));let m=!1;if(e.str.length>1)m=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),n=Math.abs(e.transform[3]);t!==n&&Math.max(t,n)/Math.min(t,n)>1.5&&(m=!0)}if(m&&(n.canvasWidth=o.vertical?e.height:e.width),this.#In.set(t,n),this.#Sn.div=t,this.#Sn.properties=n,this.#Xn(this.#Sn),n.hasText&&this.#me.append(t),n.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this.#me.append(e)}}#Xn(e){const{div:t,properties:n,ctx:r}=e,{style:a}=t;let o="";if(vce.#$n>1&&(o=`scale(${1/vce.#$n})`),0!==n.canvasWidth&&n.hasText){const{fontFamily:e}=a,{canvasWidth:c,fontSize:i}=n;vce.#Zn(r,i*this.#Nn,e);const{width:l}=r.measureText(t.textContent);l>0&&(o=`scaleX(${c*this.#Nn/l}) ${o}`)}0!==n.angle&&(o=`rotate(${n.angle}deg) ${o}`),o.length>0&&(a.transform=o)}static cleanup(){if(!(this.#qn.size>0)){this.#jn.clear();for(const{canvas:e}of this.#Un.values())e.remove();this.#Un.clear()}}static#Kn(e=null){let t=this.#Un.get(e||="");if(!t){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=e,document.body.append(n),t=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#Un.set(e,t),this.#Wn.set(t,{size:0,family:""})}return t}static#Zn(e,t,n){const r=this.#Wn.get(e);t===r.size&&n===r.family||(e.font=`${t}px ${n}`,r.size=t,r.family=n)}static#Gn(){if(null!==this.#$n)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#$n=e.getBoundingClientRect().height,e.remove()}static#Jn(e,t){const n=this.#jn.get(e);if(n)return n;const r=this.#Kn(t);r.canvas.width=r.canvas.height=pce,this.#Zn(r,pce,e);const a=r.measureText("");let o=a.fontBoundingBoxAscent,c=Math.abs(a.fontBoundingBoxDescent);if(o){const t=o/(o+c);return this.#jn.set(e,t),r.canvas.width=r.canvas.height=0,t}r.strokeStyle="red",r.clearRect(0,0,pce,pce),r.strokeText("g",0,0);let i=r.getImageData(0,0,pce,pce).data;c=0;for(let e=i.length-1-3;e>=0;e-=4)if(i[e]>0){c=Math.ceil(e/4/pce);break}r.clearRect(0,0,pce,pce),r.strokeText("A",0,pce),i=r.getImageData(0,0,pce,pce).data,o=0;for(let e=0,t=i.length;e<t;e+=4)if(i[e]>0){o=pce-Math.floor(e/4/pce);break}r.canvas.width=r.canvas.height=0;const l=o?o/(o+c):.8;return this.#jn.set(e,l),l}}class fce{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};return function e(n){if(!n)return;let r=null;const a=n.name;if("#text"===a)r=n.value;else{if(!fce.shouldBuildText(a))return;n?.attributes?.textContent?r=n.attributes.textContent:n.value&&(r=n.value)}if(null!==r&&t.push({str:r}),n.children)for(const t of n.children)e(t)}(e),n}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}const zce=65536,gce=Are?class extends loe{_createCanvas(e,t){return St.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}:class extends loe{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const n=this._document.createElement("canvas");return n.width=e,n.height=t,n}},yce=Are?class extends soe{async _fetch(e){return poe(e)}}:hoe,Mce=Are?class extends doe{}:class extends doe{#er;#tr;#nr;#rr;#ar;#or;#y=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#rr=e,this.#ar=t}get#E(){return this.#tr||=new Map}get#cr(){return this.#or||=new Map}get#ir(){if(!this.#nr){const e=this.#ar.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;const n=this.#ar.createElementNS(zae,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#nr=this.#ar.createElementNS(zae,"defs"),e.append(n),n.append(this.#nr),this.#ar.body.append(e)}return this.#nr}#lr(e){if(1===e.length){const t=e[0],n=new Array(256);for(let e=0;e<256;e++)n[e]=t[e]/255;const r=n.join(",");return[r,r,r]}const[t,n,r]=e,a=new Array(256),o=new Array(256),c=new Array(256);for(let e=0;e<256;e++)a[e]=t[e]/255,o[e]=n[e]/255,c[e]=r[e]/255;return[a.join(","),o.join(","),c.join(",")]}#sr(e){if(void 0===this.#er){this.#er="";const e=this.#ar.URL;e!==this.#ar.baseURI&&(bae(e)?Yre('#createUrl: ignore "data:"-URL for performance reasons.'):this.#er=e.split("#",1)[0])}return`url(${this.#er}#${e})`}addFilter(e){if(!e)return"none";let t=this.#E.get(e);if(t)return t;const[n,r,a]=this.#lr(e),o=1===e.length?n:`${n}${r}${a}`;if(t=this.#E.get(o),t)return this.#E.set(e,t),t;const c=`g_${this.#rr}_transfer_map_${this.#y++}`,i=this.#sr(c);this.#E.set(e,i),this.#E.set(o,i);const l=this.#hr(c);return this.#dr(n,r,a,l),i}addHCMFilter(e,t){const n=`${e}-${t}`,r="base";let a=this.#cr.get(r);if(a?.key===n)return a.url;if(a?(a.filter?.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},this.#cr.set(r,a)),!e||!t)return a.url;const o=this.#ur(e);e=uae.makeHexColor(...o);const c=this.#ur(t);if(t=uae.makeHexColor(...c),this.#ir.style.color="","#000000"===e&&"#ffffff"===t||e===t)return a.url;const i=new Array(256);for(let e=0;e<=255;e++){const t=e/255;i[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=i.join(","),s=`g_${this.#rr}_hcm_filter`,h=a.filter=this.#hr(s);this.#dr(l,l,l,h),this.#mr(h);const d=(e,t)=>{const n=o[e]/255,r=c[e]/255,a=new Array(t+1);for(let e=0;e<=t;e++)a[e]=n+e/t*(r-n);return a.join(",")};return this.#dr(d(0,5),d(1,5),d(2,5),h),a.url=this.#sr(s),a.url}addAlphaFilter(e){let t=this.#E.get(e);if(t)return t;const[n]=this.#lr([e]),r=`alpha_${n}`;if(t=this.#E.get(r),t)return this.#E.set(e,t),t;const a=`g_${this.#rr}_alpha_map_${this.#y++}`,o=this.#sr(a);this.#E.set(e,o),this.#E.set(r,o);const c=this.#hr(a);return this.#pr(n,c),o}addLuminosityFilter(e){let t,n,r=this.#E.get(e||"luminosity");if(r)return r;if(e?([t]=this.#lr([e]),n=`luminosity_${t}`):n="luminosity",r=this.#E.get(n),r)return this.#E.set(e,r),r;const a=`g_${this.#rr}_luminosity_map_${this.#y++}`,o=this.#sr(a);this.#E.set(e,o),this.#E.set(n,o);const c=this.#hr(a);return this.#vr(c),e&&this.#pr(t,c),o}addHighlightHCMFilter(e,t,n,r,a){const o=`${t}-${n}-${r}-${a}`;let c=this.#cr.get(e);if(c?.key===o)return c.url;if(c?(c.filter?.remove(),c.key=o,c.url="none",c.filter=null):(c={key:o,url:"none",filter:null},this.#cr.set(e,c)),!t||!n)return c.url;const[i,l]=[t,n].map(this.#ur.bind(this));let s=Math.round(.2126*i[0]+.7152*i[1]+.0722*i[2]),h=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[d,u]=[r,a].map(this.#ur.bind(this));h<s&&([s,h,d,u]=[h,s,u,d]),this.#ir.style.color="";const m=(e,t,n)=>{const r=new Array(256),a=(h-s)/n,o=e/255,c=(t-e)/(255*n);let i=0;for(let e=0;e<=n;e++){const t=Math.round(s+e*a),n=o+e*c;for(let e=i;e<=t;e++)r[e]=n;i=t+1}for(let e=i;e<256;e++)r[e]=r[i-1];return r.join(",")},p=`g_${this.#rr}_hcm_${e}_filter`,v=c.filter=this.#hr(p);return this.#mr(v),this.#dr(m(d[0],u[0],5),m(d[1],u[1],5),m(d[2],u[2],5),v),c.url=this.#sr(p),c.url}destroy(e=!1){e&&this.#or?.size||(this.#nr?.parentNode.parentNode.remove(),this.#nr=null,this.#tr?.clear(),this.#tr=null,this.#or?.clear(),this.#or=null,this.#y=0)}#vr(e){const t=this.#ar.createElementNS(zae,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(t)}#mr(e){const t=this.#ar.createElementNS(zae,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(t)}#hr(e){const t=this.#ar.createElementNS(zae,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#ir.append(t),t}#fr(e,t,n){const r=this.#ar.createElementNS(zae,t);r.setAttribute("type","discrete"),r.setAttribute("tableValues",n),e.append(r)}#dr(e,t,n,r){const a=this.#ar.createElementNS(zae,"feComponentTransfer");r.append(a),this.#fr(a,"feFuncR",e),this.#fr(a,"feFuncG",t),this.#fr(a,"feFuncB",n)}#pr(e,t){const n=this.#ar.createElementNS(zae,"feComponentTransfer");t.append(n),this.#fr(n,"feFuncA",e)}#ur(e){return this.#ir.style.color=e,Oae(getComputedStyle(this.#ir).getPropertyValue("color"))}},Ece=Are?class extends uoe{async _fetch(e){return poe(e)}}:moe;function bce(e={}){"string"==typeof e||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new Vce,{docId:n}=t,r=e.url?function(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(Are&&"string"==typeof e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(e.url):null,a=e.data?function(e){if(Are&&void 0!==kL&&e instanceof kL)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return lae(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"object"==typeof e&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(e.data):null,o=e.httpHeaders||null,c=!0===e.withCredentials,i=e.password??null,l=e.range instanceof Cce?e.range:null,s=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:zce;let h=e.worker instanceof Sce?e.worker:null;const d=e.verbosity,u="string"!=typeof e.docBaseUrl||bae(e.docBaseUrl)?null:e.docBaseUrl,m="string"==typeof e.cMapUrl?e.cMapUrl:null,p=!1!==e.cMapPacked,v=e.CMapReaderFactory||yce,f="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,z=e.StandardFontDataFactory||Ece,g=!0!==e.stopAtErrors,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,M=!1!==e.isEvalSupported,E="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!Are,b="boolean"==typeof e.isImageDecoderSupported?e.isImageDecoderSupported:!Are&&(hae.platform.isFirefox||!globalThis.chrome),H=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,V="boolean"==typeof e.disableFontFace?e.disableFontFace:Are,C=!0===e.fontExtraProperties,L=!0===e.enableXfa,k=e.ownerDocument||globalThis.document,w=!0===e.disableRange,S=!0===e.disableStream,x=!0===e.disableAutoFetch,T=!0===e.pdfBug,O=e.CanvasFactory||gce,A=e.FilterFactory||Mce,R=!0===e.enableHWA,N=l?l.length:e.length??NaN,_="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!Are&&!V,D="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:v===hoe&&z===moe&&m&&f&&kae(m,document.baseURI)&&kae(f,document.baseURI);!function(e){Number.isInteger(e)&&($re=e)}(d);const P={canvasFactory:new O({ownerDocument:k,enableHWA:R}),filterFactory:new A({docId:n,ownerDocument:k}),cMapReaderFactory:D?null:new v({baseUrl:m,isCompressed:p}),standardFontDataFactory:D?null:new z({baseUrl:f})};if(!h){const e={verbosity:d,port:Boe.workerPort};h=e.port?Sce.fromPort(e):new Sce(e),t._worker=h}const F={docId:n,apiVersion:"4.10.38",data:a,password:i,disableAutoFetch:x,rangeChunkSize:s,length:N,docBaseUrl:u,enableXfa:L,evaluatorOptions:{maxImageSize:y,disableFontFace:V,ignoreErrors:g,isEvalSupported:M,isOffscreenCanvasSupported:E,isImageDecoderSupported:b,canvasMaxAreaInBytes:H,fontExtraProperties:C,useSystemFonts:_,cMapUrl:D?m:null,standardFontDataUrl:D?f:null}},I={disableFontFace:V,fontExtraProperties:C,ownerDocument:k,pdfBug:T,styleElement:null,loadingParams:{disableAutoFetch:x,enableXfa:L}};return h.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const e=h.messageHandler.sendWithPromise("GetDocRequest",F,a?[a.buffer]:null);let i;if(l)i=new qoe(l,{disableRange:w,disableStream:S});else if(!a){if(!r)throw new Error("getDocument - no `url` parameter provided.");let e;if(Are)if(kae(r)){if("undefined"==typeof fetch||"undefined"==typeof Response||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");e=rce}else e=dce;else e=kae(r)?rce:ice;i=new e({url:r,length:N,httpHeaders:o,withCredentials:c,rangeChunkSize:s,disableRange:w,disableStream:S})}return e.then((e=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const r=new ioe(n,e,h.port),a=new xce(r,t,i,I,P);t._transport=a,r.send("Ready",null)}))})).catch(t._capability.reject),t}function Hce(e){return"object"==typeof e&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class Vce{static#rr=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+Vce.#rr++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await(this._transport?.destroy())}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}}class Cce{constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const n of this._rangeListeners)n(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const n of this._progressListeners)n(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){Kre("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Lce{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Jre(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class kce{#zr=null;#gr=!1;constructor(e,t,n,r=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=r?new Lae:null,this._pdfBug=r,this.commonObjs=n.commonObjs,this.objs=new Oce,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:a=!1}={}){return new Mae({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:a})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Jre(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:n="display",annotationMode:r=Dre.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:c=null,annotationCanvasMap:i=null,pageColors:l=null,printAnnotationStorage:s=null,isEditing:h=!1}){this._stats?.time("Overall");const d=this._transport.getRenderingIntent(n,r,s,h),{renderingIntent:u,cacheKey:m}=d;this.#gr=!1,this.#yr(),c||=this._transport.getOptionalContentConfig(u);let p=this._intentStates.get(m);p||(p=Object.create(null),this._intentStates.set(m,p)),p.streamReaderCancelTimeout&&(clearTimeout(p.streamReaderCancelTimeout),p.streamReaderCancelTimeout=null);const v=!!(4&u);p.displayReadyCapability||(p.displayReadyCapability=Promise.withResolvers(),p.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(d));const f=e=>{p.renderTasks.delete(z),(this._maybeCleanupAfterRender||v)&&(this.#gr=!0),this.#Mr(!v),e?(z.capability.reject(e),this._abortOperatorList({intentState:p,reason:e instanceof Error?e:new Error(e)})):z.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},z=new Rce({callback:f,params:{canvasContext:e,viewport:t,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:i,operatorList:p.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!v,pdfBug:this._pdfBug,pageColors:l});(p.renderTasks||=new Set).add(z);const g=z.task;return Promise.all([p.displayReadyCapability.promise,c]).then((([e,t])=>{if(this.destroyed)f();else{if(this._stats?.time("Rendering"),!(t.renderingIntent&u))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");z.initializeGraphics({transparency:e,optionalContentConfig:t}),z.operatorListChanged()}})).catch(f),g}getOperatorList({intent:e="display",annotationMode:t=Dre.ENABLE,printAnnotationStorage:n=null,isEditing:r=!1}={}){const a=this._transport.getRenderingIntent(e,t,n,r,!0);let o,c=this._intentStates.get(a.cacheKey);return c||(c=Object.create(null),this._intentStates.set(a.cacheKey,c)),c.opListReadCapability||(o=Object.create(null),o.operatorListChanged=function(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(o))},c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||=new Set).add(o),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>fce.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,n){const r=t.getReader(),a={items:[],styles:Object.create(null),lang:null};!function t(){r.read().then((function({value:n,done:r}){r?e(a):(a.lang??=n.lang,Object.assign(a.styles,n.styles),a.items.push(...n.items),t())}),n)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#gr=!1,this.#yr(),Promise.all(e)}cleanup(e=!1){this.#gr=!0;const t=this.#Mr(!1);return e&&t&&(this._stats&&=new Lae),t}#Mr(e=!1){if(this.#yr(),!this.#gr||this.destroyed)return!1;if(e)return this.#zr=setTimeout((()=>{this.#zr=null,this.#Mr(!1)}),5e3),!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#gr=!1,!0}#yr(){this.#zr&&(clearTimeout(this.#zr),this.#zr=null)}_startRenderPage(e,t){const n=this._intentStates.get(t);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#Mr(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:r}){const{map:a,transfer:o}=n,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:a,modifiedIds:r},o).getReader(),i=this._intentStates.get(t);i.streamReader=c;const l=()=>{c.read().then((({value:e,done:t})=>{t?i.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,i),l())}),(e=>{if(i.streamReader=null,!this._transport.destroyed){if(i.operatorList){i.operatorList.lastChunk=!0;for(const e of i.renderTasks)e.operatorListChanged();this.#Mr(!0)}if(i.displayReadyCapability)i.displayReadyCapability.reject(e);else{if(!i.opListReadCapability)throw e;i.opListReadCapability.reject(e)}}}))};l()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(t instanceof Eae){let n=100;return t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})}),n))}}if(e.streamReader.cancel(new cae(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}class wce{#Er=new Map;#br=Promise.resolve();postMessage(e,t){const n={data:structuredClone(e,t?{transfer:t}:null)};this.#br.then((()=>{for(const[e]of this.#Er)e.call(this,n)}))}addEventListener(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){const{signal:a}=n;if(a.aborted)return void Yre("LoopbackPort - cannot use an `aborted` signal.");const o=()=>this.removeEventListener(e,t);r=()=>a.removeEventListener("abort",o),a.addEventListener("abort",o)}this.#Er.set(t,r)}removeEventListener(e,t){const n=this.#Er.get(t);n?.(),this.#Er.delete(t)}terminate(){for(const[,e]of this.#Er)e?.();this.#Er.clear()}}class Sce{static#Hr=0;static#Vr=!1;static#Cr;static{Are&&(this.#Vr=!0,Boe.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(e,t)=>{let n;try{if(n=new URL(e),!n.origin||"null"===n.origin)return!1}catch{return!1}const r=new URL(t,n);return n.origin===r.origin},this._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))}}constructor({name:e=null,port:t=null,verbosity:n=qre()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if(Sce.#Cr?.has(t))throw new Error("Cannot use more than one PDFWorker per port.");return(Sce.#Cr||=new WeakMap).set(t,this),void this._initializeFromPort(t)}this._initialize()}get promise(){return this._readyCapability.promise}#Lr(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new ioe("main","worker",e),this._messageHandler.on("ready",(function(){})),this.#Lr()}_initialize(){if(Sce.#Vr||Sce.#kr)return void this._setupFakeWorker();let{workerSrc:e}=Sce;try{Sce._isSameOrigin(window.location.href,e)||(e=Sce._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),n=new ioe("main","worker",t),r=()=>{a.abort(),n.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},a=new AbortController;t.addEventListener("error",(()=>{this._webWorker||r()}),{signal:a.signal}),n.on("test",(e=>{a.abort(),!this.destroyed&&e?(this._messageHandler=n,this._port=t,this._webWorker=t,this.#Lr()):r()})),n.on("ready",(e=>{if(a.abort(),this.destroyed)r();else try{o()}catch{this._setupFakeWorker()}}));const o=()=>{const e=new Uint8Array;n.send("test",e,[e.buffer])};return void o()}catch{Gre("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){Sce.#Vr||(Yre("Setting up fake worker."),Sce.#Vr=!0),Sce._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new wce;this._port=t;const n="fake"+Sce.#Hr++,r=new ioe(n+"_worker",n,t);e.setup(r,t),this._messageHandler=new ioe(n,n+"_worker",t),this.#Lr()})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker?.terminate(),this._webWorker=null,Sce.#Cr?.delete(this._port),this._port=null,this._messageHandler?.destroy(),this._messageHandler=null}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const t=this.#Cr?.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new Sce(e)}static get workerSrc(){if(Boe.workerSrc)return Boe.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#kr(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return Jre(this,"_setupFakeWorkerGlobal",(async()=>this.#kr?this.#kr:(await import(this.workerSrc)).WorkerMessageHandler)())}}class xce{#wr=new Map;#Sr=new Map;#xr=new Map;#Tr=new Map;#Or=null;constructor(e,t,n,r,a){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new Oce,this.fontLoader=new roe({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.cMapReaderFactory=a.cMapReaderFactory,this.standardFontDataFactory=a.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#Ar(e,t=null){const n=this.#wr.get(e);if(n)return n;const r=this.messageHandler.sendWithPromise(e,t);return this.#wr.set(e,r),r}get annotationStorage(){return Jre(this,"annotationStorage",new toe)}getRenderingIntent(e,t=Dre.ENABLE,n=null,r=!1,a=!1){let o=2,c=eoe;switch(e){case"any":o=1;break;case"display":break;case"print":o=4;break;default:Yre(`getRenderingIntent - invalid intent: ${e}`)}const i=4&o&&n instanceof noe?n:this.annotationStorage;switch(t){case Dre.DISABLE:o+=64;break;case Dre.ENABLE:break;case Dre.ENABLE_FORMS:o+=16;break;case Dre.ENABLE_STORAGE:o+=32,c=i.serializable;break;default:Yre(`getRenderingIntent - invalid annotationMode: ${t}`)}r&&(o+=128),a&&(o+=256);const{ids:l,hash:s}=i.modifiedIds;return{renderingIntent:o,cacheKey:[o,c.hash,s].join("_"),annotationStorageSerializable:c,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#Or?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#Sr.values())e.push(t._destroy());this.#Sr.clear(),this.#xr.clear(),this.#Tr.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#wr.clear(),this.filterFactory.destroy(),vce.cleanup(),this._networkStream?.cancelAllRequests(new cae("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{Xre(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:n}){n?t.close():(Xre(e instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(async e=>{await this._fullReader.headersReady;const{isStreamingSupported:n,isRangeSupported:r,contentLength:a}=this._fullReader;return n&&r||(this._lastProgress&&t.onProgress?.(this._lastProgress),this._fullReader.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),{isStreamingSupported:n,isRangeSupported:r,contentLength:a}})),e.on("GetRangeReader",((e,t)=>{Xre(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(e.begin,e.end);n?(t.onPull=()=>{n.read().then((function({value:e,done:n}){n?t.close():(Xre(e instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{n.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new Lce(e,this))})),e.on("DocException",(e=>{t._capability.reject(coe(e))})),e.on("PasswordRequest",(e=>{this.#Or=Promise.withResolvers();try{if(!t.onPassword)throw coe(e);const n=e=>{e instanceof Error?this.#Or.reject(e):this.#Or.resolve({password:e})};t.onPassword(n,e.code)}catch(e){this.#Or.reject(e)}return this.#Or.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{this.destroyed||this.#Sr.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,n,r])=>{if(this.destroyed)return null;if(this.commonObjs.has(t))return null;switch(n){case"Font":const{disableFontFace:a,fontExtraProperties:o,pdfBug:c}=this._params;if("error"in r){const e=r.error;Yre(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}const i=c&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,l=new aoe(r,{disableFontFace:a,fontExtraProperties:o,inspectFont:i});this.fontLoader.bind(l).catch((()=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!o&&l.data&&(l.data=null),this.commonObjs.resolve(t,l)}));break;case"CopyLocalImage":const{imageRef:s}=r;Xre(s,"The imageRef must be defined.");for(const e of this.#Sr.values())for(const[,n]of e.objs)if(n?.ref===s)return n.dataLen?(this.commonObjs.resolve(t,structuredClone(n)),n.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(t,r);break;default:throw new Error(`Got unknown common object type ${n}`)}return null})),e.on("obj",(([e,t,n,r])=>{if(this.destroyed)return;const a=this.#Sr.get(t);if(!a.objs.has(e))if(0!==a._intentStates.size)switch(n){case"Image":a.objs.resolve(e,r),r?.dataLen>1e7&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(e,r);break;default:throw new Error(`Got unknown object type ${n}`)}else r?.bitmap?.close()})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("FetchBuiltInCMap",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(e)})),e.on("FetchStandardFontData",(async e=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(e)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Yre("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally((()=>{this.annotationStorage.resetModified()}))}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,n=this.#xr.get(t);if(n)return n;const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&this.#Tr.set(n.refStr,e);const r=new kce(t,n,this,this._params.pdfBug);return this.#Sr.set(t,r),r}));return this.#xr.set(t,r),r}getPageIndex(e){return Hce(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#Ar("GetFieldObjects")}hasJSActions(){return this.#Ar("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#Ar("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#Ar("GetOptionalContentConfig").then((t=>new $oe(t,e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=this.#wr.get(e);if(t)return t;const n=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new joe(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#wr.set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#Sr.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#wr.clear(),this.filterFactory.destroy(!0),vce.cleanup()}}cachedPageNumber(e){if(!Hce(e))return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#Tr.get(t)??null}}const Tce=Symbol("INITIAL_DATA");class Oce{#Rr=Object.create(null);#Nr(e){return this.#Rr[e]||={...Promise.withResolvers(),data:Tce}}get(e,t=null){if(t){const n=this.#Nr(e);return n.promise.then((()=>t(n.data))),null}const n=this.#Rr[e];if(!n||n.data===Tce)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const t=this.#Rr[e];return!!t&&t.data!==Tce}delete(e){const t=this.#Rr[e];return!(!t||t.data===Tce||(delete this.#Rr[e],0))}resolve(e,t=null){const n=this.#Nr(e);n.data=t,n.resolve()}clear(){for(const e in this.#Rr){const{data:t}=this.#Rr[e];t?.bitmap?.close()}this.#Rr=Object.create(null)}*[Symbol.iterator](){for(const e in this.#Rr){const{data:t}=this.#Rr[e];t!==Tce&&(yield[e,t])}}}class Ace{#_r=null;constructor(e){this.#_r=e,this.onContinue=null}get promise(){return this.#_r.capability.promise}cancel(e=0){this.#_r.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#_r.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#_r;return e.form||e.canvas&&t?.size>0}}class Rce{#Dr=null;static#Pr=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:a,operatorList:o,pageIndex:c,canvasFactory:i,filterFactory:l,useRequestAnimationFrame:s=!1,pdfBug:h=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=c,this.canvasFactory=i,this.filterFactory=l,this._pdfBug=h,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===s&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Ace(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(Rce.#Pr.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");Rce.#Pr.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:r,transform:a,background:o}=this.params;this.gfx=new Ioe(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:a,viewport:r,transparency:e,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#Dr&&(window.cancelAnimationFrame(this.#Dr),this.#Dr=null),Rce.#Pr.delete(this._canvas),this.callback(e||new Eae(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#Dr=window.requestAnimationFrame((()=>{this.#Dr=null,this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),Rce.#Pr.delete(this._canvas),this.callback())))}}const Nce="4.10.38",_ce="f9bea397f";function Dce(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function Pce(e){return Math.max(0,Math.min(255,255*e))}class Fce{static CMYK_G([e,t,n,r]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return[e=Pce(e),e,e]}static G_HTML([e]){const t=Dce(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return["G",.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(Pce)}static RGB_HTML(e){return`#${e.map(Dce).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return["RGB",1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,r]){return[Pce(1-Math.min(1,e+r)),Pce(1-Math.min(1,n+r)),Pce(1-Math.min(1,t+r))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){const r=1-e,a=1-t,o=1-n;return["CMYK",r,a,o,Math.min(r,a,o)]}}class Ice{create(e,t,n=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),n||(r.setAttribute("width",`${e}px`),r.setAttribute("height",`${t}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e} ${t}`),r}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Kre("Abstract method `_createSVG` called.")}}class Bce extends Ice{_createSVG(e){return document.createElementNS(zae,e)}}class jce{static setupStorage(e,t,n,r,a){const o=r.getValue(t,{value:null});switch(n.name){case"textarea":if(null!==o.value&&(e.textContent=o.value),"print"===a)break;e.addEventListener("input",(e=>{r.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===n.attributes.type||"checkbox"===n.attributes.type){if(o.value===n.attributes.xfaOn?e.setAttribute("checked",!0):o.value===n.attributes.xfaOff&&e.removeAttribute("checked"),"print"===a)break;e.addEventListener("change",(e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==o.value&&e.setAttribute("value",o.value),"print"===a)break;e.addEventListener("input",(e=>{r.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==o.value){e.setAttribute("value",o.value);for(const e of n.children)e.attributes.value===o.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",(e=>{const n=e.target.options,a=-1===n.selectedIndex?"":n[n.selectedIndex].value;r.setValue(t,{value:a})}))}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:a}){const{attributes:o}=t,c=e instanceof HTMLAnchorElement;"radio"===o.type&&(o.name=`${o.name}-${r}`);for(const[t,n]of Object.entries(o))if(null!=n)switch(t){case"class":n.length&&e.setAttribute(t,n.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",n);break;case"style":Object.assign(e.style,n);break;case"textContent":e.textContent=n;break;default:(!c||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,n)}c&&a.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,t,n)}static render(e){const t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,a=e.intent||"display",o=document.createElement(r.name);r.attributes&&this.setAttributes({html:o,element:r,intent:a,linkService:n});const c="richText"!==a,i=e.div;if(i.append(o),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;i.style.transform=t}c&&i.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===r.children.length){if(r.value){const e=document.createTextNode(r.value);o.append(e),c&&fce.shouldBuildText(r.name)&&l.push(e)}return{textDivs:l}}const s=[[r,-1,o]];for(;s.length>0;){const[e,r,o]=s.at(-1);if(r+1===e.children.length){s.pop();continue}const i=e.children[++s.at(-1)[1]];if(null===i)continue;const{name:h}=i;if("#text"===h){const e=document.createTextNode(i.value);l.push(e),o.append(e);continue}const d=i?.attributes?.xmlns?document.createElementNS(i.attributes.xmlns,h):document.createElement(h);if(o.append(d),i.attributes&&this.setAttributes({html:d,element:i,storage:t,intent:a,linkService:n}),i.children?.length>0)s.push([i,-1,d]);else if(i.value){const e=document.createTextNode(i.value);c&&fce.shouldBuildText(h)&&l.push(e),d.append(e)}}for(const e of i.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:l}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const Uce=1e3,Wce=new WeakSet;function $ce(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class qce{static create(e){switch(e.data.annotationType){case 2:return new Yce(e);case 1:return new Kce(e);case 20:switch(e.data.fieldType){case"Tx":return new Qce(e);case"Btn":return e.data.radioButton?new eie(e):e.data.checkBox?new Zce(e):new tie(e);case"Ch":return new nie(e);case"Sig":return new Jce(e)}return new Xce(e);case 16:return new rie(e);case 3:return new oie(e);case 4:return new cie(e);case 5:return new iie(e);case 6:return new lie(e);case 8:return new sie(e);case 14:return new die(e);case 15:return new uie(e);case 7:return new hie(e);case 9:return new mie(e);case 10:return new pie(e);case 11:return new vie(e);case 12:return new fie(e);case 13:return new zie(e);case 17:return new gie(e);default:return new Gce(e)}}}class Gce{#Fr=null;#Ir=!1;#Br=null;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(n)),r&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:n}){return!!(e?.str||t?.str||n?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Gce._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;this.#Fr||={rect:this.data.rect.slice(0)};const{rect:t}=e;t&&this.#jr(t),this.#Br?.popup.updateEdited(e)}resetEdited(){this.#Fr&&(this.#jr(this.#Fr.rect),this.#Br?.popup.resetEdited(),this.#Fr=null)}#jr(e){const{container:{style:t},data:{rect:n,rotation:r},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:o,pageX:c,pageY:i}}}}=this;n?.splice(0,4,...e);const{width:l,height:s}=$ce(e);t.left=100*(e[0]-c)/a+"%",t.top=100*(o-e[3]+i)/o+"%",0===r?(t.width=100*l/a+"%",t.height=100*s/o+"%"):this.setRotation(r)}_createContainer(e){const{data:t,parent:{page:n,viewport:r}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",t.id),this instanceof Xce||(a.tabIndex=Uce);const{style:o}=a;if(o.zIndex=this.parent.zIndex++,t.alternativeText&&(a.title=t.alternativeText),t.noRotate&&a.classList.add("norotate"),!t.rect||this instanceof rie){const{rotation:e}=t;return t.hasOwnCanvas||0===e||this.setRotation(e,a),a}const{width:c,height:i}=$ce(t.rect);if(!e&&t.borderStyle.width>0){o.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;if(e>0||n>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${n}px * var(--scale-factor))`;o.borderRadius=t}else if(this instanceof eie){const e=`calc(${c}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;o.borderRadius=e}switch(t.borderStyle.style){case 1:o.borderStyle="solid";break;case 2:o.borderStyle="dashed";break;case 3:Yre("Unimplemented border style: beveled");break;case 4:Yre("Unimplemented border style: inset");break;case 5:o.borderBottomStyle="solid"}const r=t.borderColor||null;r?(this.#Ir=!0,o.borderColor=uae.makeHexColor(0|r[0],0|r[1],0|r[2])):o.borderWidth=0}const l=uae.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:s,pageHeight:h,pageX:d,pageY:u}=r.rawDims;o.left=100*(l[0]-d)/s+"%",o.top=100*(l[1]-u)/h+"%";const{rotation:m}=t;return t.hasOwnCanvas||0===m?(o.width=100*c/s+"%",o.height=100*i/h+"%"):this.setRotation(m,a),a}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims,{width:a,height:o}=$ce(this.data.rect);let c,i;e%180==0?(c=100*a/n,i=100*o/r):(c=100*o/n,i=100*a/r),t.style.width=`${c}%`,t.style.height=`${i}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,n)=>{const r=n.detail[e],a=r[0],o=r.slice(1);n.target.style[t]=Fce[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[t]:Fce[`${a}_rgb`](o)})};return Jre(this,"_commonActions",{display:e=>{const{display:t}=e.detail,n=t%2==1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const n=this._commonActions;for(const r of Object.keys(t.detail)){const a=e[r]||n[r];a?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const n=this._commonActions;for(const[r,a]of Object.entries(t)){const o=n[r];o&&(o({detail:{[r]:a},target:e}),delete t[r])}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,n,r,a]=this.data.rect.map((e=>Math.fround(e)));if(8===e.length){const[o,c,i,l]=e.subarray(2,6);if(r===o&&a===c&&t===i&&n===l)return}const{style:o}=this.container;let c;if(this.#Ir){const{borderColor:e,borderWidth:t}=o;o.borderWidth=0,c=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add("hasBorder")}const i=r-t,l=a-n,{svgFactory:s}=this,h=s.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0);const d=s.createElement("defs");h.append(d);const u=s.createElement("clipPath"),m=`clippath_${this.data.id}`;u.setAttribute("id",m),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let n=2,r=e.length;n<r;n+=8){const r=e[n],o=e[n+1],h=e[n+2],d=e[n+3],m=s.createElement("rect"),p=(h-t)/i,v=(a-o)/l,f=(r-h)/i,z=(o-d)/l;m.setAttribute("x",p),m.setAttribute("y",v),m.setAttribute("width",f),m.setAttribute("height",z),u.append(m),c?.push(`<rect vector-effect="non-scaling-stroke" x="${p}" y="${v}" width="${f}" height="${z}"/>`)}this.#Ir&&(c.push("</g></svg>')"),o.backgroundImage=c.join("")),this.container.append(h),this.container.style.clipPath=`url(#${m})`}_createPopup(){const{data:e}=this,t=this.#Br=new rie({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(t.render())}render(){Kre("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const n=[];if(this._fieldObjects){const r=this._fieldObjects[e];if(r)for(const{page:e,id:a,exportValues:o}of r){if(-1===e)continue;if(a===t)continue;const r="string"==typeof o?o:null,c=document.querySelector(`[data-element-id="${a}"]`);!c||Wce.has(c)?n.push({id:a,exportValue:r,domElement:c}):Yre(`_getElementsByName - element not allowed: ${a}`)}return n}for(const r of document.getElementsByName(e)){const{exportValue:e}=r,a=r.getAttribute("data-element-id");a!==t&&Wce.has(r)&&n.push({id:a,exportValue:e,domElement:r})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})}))}}class Yce extends Gce{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action),r=!0):e.attachment?(this.#Ur(n,e.attachment,e.attachmentDest),r=!0):e.setOCGState?(this.#Wr(n,e.setOCGState),r=!0):e.dest?(this._bindLink(n,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&this.container.append(n),this.container}#$r(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#$r()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#$r()}#Ur(e,t,n=null){e.href=this.linkService.getAnchorUrl(""),t.description&&(e.title=t.description),e.onclick=()=>(this.downloadManager?.openOrDownloadData(t.content,t.filename,n),!1),this.#$r()}#Wr(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#$r()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(t.actions)){const a=n.get(r);a&&(e[a]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:r}}),!1))}e.onclick||(e.onclick=()=>!1),this.#$r()}_bindResetFormAction(e,t){const n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),this.#$r(),!this._fieldObjects)return Yre('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(n||(e.onclick=()=>!1));e.onclick=()=>{n?.();const{fields:e,refs:r,include:a}=t,o=[];if(0!==e.length||0!==r.length){const t=new Set(r);for(const n of e){const e=this._fieldObjects[n]||[];for(const{id:n}of e)t.add(n)}for(const e of Object.values(this._fieldObjects))for(const n of e)t.has(n.id)===a&&o.push(n)}else for(const e of Object.values(this._fieldObjects))o.push(...e);const c=this.annotationStorage,i=[];for(const e of o){const{id:t}=e;switch(i.push(t),e.type){case"text":{const n=e.defaultValue||"";c.setValue(t,{value:n});break}case"checkbox":case"radiobutton":{const n=e.defaultValue===e.exportValues;c.setValue(t,{value:n});break}case"combobox":case"listbox":{const n=e.defaultValue||"";c.setValue(t,{value:n});break}default:continue}const n=document.querySelector(`[data-element-id="${t}"]`);n&&(Wce.has(n)?n.dispatchEvent(new Event("resetform")):Yre(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:i,name:"ResetForm"}}),!1}}}class Kce extends Gce{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class Xce extends Gce{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&("CANVAS"===e.previousSibling?.nodeName&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return hae.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,r,a){n.includes("mouse")?e.addEventListener(n,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:a(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(n,(e=>{if("blur"===n){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if("focus"===n){if(t.focused)return;t.focused=!0}a&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:a(e)}})}))}_setEventListeners(e,t,n,r){for(const[a,o]of n)("Action"===o||this.data.actions?.[o])&&("Focus"!==o&&"Blur"!==o||(t||={focused:!1}),this._setEventListener(e,t,a,o,r),"Focus"!==o||this.data.actions?.Blur?"Blur"!==o||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":uae.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const{fontColor:t}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,r=e.style;let a;const o=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(_re*n))||1);a=Math.min(n,o(t/_re))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(n,o(e/_re))}r.fontSize=`calc(${a}px * var(--scale-factor))`,r.color=uae.makeHexColor(t[0],t[1],t[2]),null!==this.data.textAlignment&&(r.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class Qce extends Xce{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,n,r){const a=this.annotationStorage;for(const o of this._getElementsByName(e.name,e.id))o.domElement&&(o.domElement[t]=n),a.setValue(o.id,{[r]:n})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const r=e.getValue(t,{value:this.data.fieldValue});let a=r.value||"";const o=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;o&&a.length>o&&(a=a.slice(0,o));let c=r.formattedValue||this.data.textContent?.join("\n")||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const i={userValue:a,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=c??a,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",c??a),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Wce.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=Uce,this._setRequired(n,this.data.required),o&&(n.maxLength=o),n.addEventListener("input",(r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,"value",r.target.value,"value"),i.formattedValue=null})),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";n.value=i.userValue=t,i.formattedValue=null}));let l=e=>{const{formattedValue:t}=i;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",(e=>{if(i.focused)return;const{target:t}=e;i.userValue&&(t.value=i.userValue),i.lastCommittedValue=t.value,i.commitKey=1,this.data.actions?.Focus||(i.focused=!0)})),n.addEventListener("updatefromsandbox",(n=>{this.showElementAndHideCanvas(n.target);const r={value(n){i.userValue=n.detail.value??"",e.setValue(t,{value:i.userValue.toString()}),n.target.value=i.userValue},formattedValue(n){const{formattedValue:r}=n.detail;i.formattedValue=r,null!=r&&n.target!==document.activeElement&&(n.target.value=r),e.setValue(t,{formattedValue:r})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{const{charLimit:r}=n.detail,{target:a}=n;if(0===r)return void a.removeAttribute("maxLength");a.setAttribute("maxLength",r);let o=i.userValue;!o||o.length<=r||(o=o.slice(0,r),a.value=i.userValue=o,e.setValue(t,{value:o}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:o,willCommit:!0,commitKey:1,selStart:a.selectionStart,selEnd:a.selectionEnd}}))}};this._dispatchEventFromSandbox(r,n)})),n.addEventListener("keydown",(e=>{i.commitKey=1;let n=-1;if("Escape"===e.key?n=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(i.commitKey=3):n=2,-1===n)return;const{value:r}=e.target;i.lastCommittedValue!==r&&(i.lastCommittedValue=r,i.userValue=r,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const r=l;l=null,n.addEventListener("blur",(e=>{if(!i.focused||!e.relatedTarget)return;this.data.actions?.Blur||(i.focused=!1);const{value:n}=e.target;i.userValue=n,i.lastCommittedValue!==n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:i.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)})),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",(e=>{i.lastCommittedValue=null;const{data:n,target:r}=e,{value:a,selectionStart:o,selectionEnd:c}=r;let l=o,s=c;switch(e.inputType){case"deleteWordBackward":{const e=a.substring(0,o).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=a.substring(o).match(/^[^\w]*\w*/);e&&(s+=e[0].length);break}case"deleteContentBackward":o===c&&(l-=1);break;case"deleteContentForward":o===c&&(s+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,change:n||"",willCommit:!1,selStart:l,selEnd:s}})})),this._setEventListeners(n,i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(l&&n.addEventListener("blur",l),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/o;n.classList.add("comb"),n.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Jce extends Xce{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class Zce extends Xce{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;"string"==typeof r&&(r="Off"!==r,e.setValue(n,{value:r})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const a=document.createElement("input");return Wce.add(a),a.setAttribute("data-element-id",n),a.disabled=t.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=t.fieldName,r&&a.setAttribute("checked",!0),a.setAttribute("exportValue",t.exportValue),a.tabIndex=Uce,a.addEventListener("change",(r=>{const{name:a,checked:o}=r.target;for(const r of this._getElementsByName(a,n)){const n=o&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:o})})),a.addEventListener("resetform",(e=>{const n=t.defaultFieldValue||"Off";e.target.checked=n===t.exportValue})),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",(t=>{const r={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(n,{value:t.target.checked})}};this._dispatchEventFromSandbox(r,t)})),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class eie extends Xce{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;if("string"==typeof r&&(r=r!==t.buttonValue,e.setValue(n,{value:r})),r)for(const r of this._getElementsByName(t.fieldName,n))e.setValue(r.id,{value:!1});const a=document.createElement("input");if(Wce.add(a),a.setAttribute("data-element-id",n),a.disabled=t.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=t.fieldName,r&&a.setAttribute("checked",!0),a.tabIndex=Uce,a.addEventListener("change",(t=>{const{name:r,checked:a}=t.target;for(const t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:a})})),a.addEventListener("resetform",(e=>{const n=t.defaultFieldValue;e.target.checked=null!=n&&n===t.buttonValue})),this.enableScripting&&this.hasJSActions){const r=t.buttonValue;a.addEventListener("updatefromsandbox",(t=>{const a={value:t=>{const a=r===t.detail.value;for(const r of this._getElementsByName(t.target.name)){const t=a&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}};this._dispatchEventFromSandbox(a,t)})),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class tie extends Yce{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class nie extends Xce{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement("select");Wce.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=Uce;let a=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of r.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),a=!1),r.append(t)}let o=null;if(a){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),r.prepend(e),o=()=>{e.remove(),r.removeEventListener("input",o),o=null},r.addEventListener("input",o)}const c=e=>{const t=e?"value":"textContent",{options:n,multiple:a}=r;return a?Array.prototype.filter.call(n,(e=>e.selected)).map((e=>e[t])):-1===n.selectedIndex?null:n[n.selectedIndex][t]};let i=c(!1);const l=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",(n=>{const a={value(n){o?.();const a=n.detail.value,l=new Set(Array.isArray(a)?a:[a]);for(const e of r.options)e.selected=l.has(e.value);e.setValue(t,{value:c(!0)}),i=c(!1)},multipleSelection(e){r.multiple=!0},remove(n){const a=r.options,o=n.detail.remove;a[o].selected=!1,r.remove(o),a.length>0&&-1===Array.prototype.findIndex.call(a,(e=>e.selected))&&(a[0].selected=!0),e.setValue(t,{value:c(!0),items:l(n)}),i=c(!1)},clear(n){for(;0!==r.length;)r.remove(0);e.setValue(t,{value:null,items:[]}),i=c(!1)},insert(n){const{index:a,displayValue:o,exportValue:s}=n.detail.insert,h=r.children[a],d=document.createElement("option");d.textContent=o,d.value=s,h?h.before(d):r.append(d),e.setValue(t,{value:c(!0),items:l(n)}),i=c(!1)},items(n){const{items:a}=n.detail;for(;0!==r.length;)r.remove(0);for(const e of a){const{displayValue:t,exportValue:n}=e,a=document.createElement("option");a.textContent=t,a.value=n,r.append(a)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:c(!0),items:l(n)}),i=c(!1)},indices(n){const r=new Set(n.detail.indices);for(const e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:c(!0)}),i=c(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(a,n)})),r.addEventListener("input",(n=>{const r=c(!0),a=c(!1);e.setValue(t,{value:r}),n.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,change:a,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(r,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))):r.addEventListener("input",(function(n){e.setValue(t,{value:c(!0)})})),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class rie extends Gce{constructor(e){const{data:t,elements:n}=e;super(e,{isRenderable:Gce._hasPopupData(t)}),this.elements=n,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new aie({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const n of this.elements)n.popup=e,n.container.ariaHasPopup="dialog",t.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",t.map((e=>`${fae}${e}`)).join(",")),this.container}}class aie{#qr=this.#Gr.bind(this);#Yr=this.#Kr.bind(this);#Xr=this.#Qr.bind(this);#Jr=this.#Zr.bind(this);#ea=null;#me=null;#ta=null;#na=null;#ra=null;#aa=null;#oa=null;#ca=!1;#ia=null;#L=null;#la=null;#sa=null;#ha=null;#Fr=null;#da=!1;constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:a,contentsObj:o,richText:c,parent:i,rect:l,parentRect:s,open:h}){this.#me=e,this.#ha=r,this.#ta=o,this.#sa=c,this.#aa=i,this.#ea=t,this.#la=l,this.#oa=s,this.#ra=n,this.#na=xae.toDateObject(a),this.trigger=n.flatMap((e=>e.getElementsToTriggerPopup()));for(const e of this.trigger)e.addEventListener("click",this.#Jr),e.addEventListener("mouseenter",this.#Xr),e.addEventListener("mouseleave",this.#Yr),e.classList.add("popupTriggerArea");for(const e of n)e.container?.addEventListener("keydown",this.#qr);this.#me.hidden=!0,h&&this.#Zr()}render(){if(this.#ia)return;const e=this.#ia=document.createElement("div");if(e.className="popup",this.#ea){const t=e.style.outlineColor=uae.makeHexColor(...this.#ea);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`;else{const t=.7;e.style.backgroundColor=uae.makeHexColor(...this.#ea.map((e=>Math.floor(t*(255-e)+e))))}}const t=document.createElement("span");t.className="header";const n=document.createElement("h1");if(t.append(n),({dir:n.dir,str:n.textContent}=this.#ha),e.append(t),this.#na){const e=document.createElement("span");e.classList.add("popupDate"),e.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),e.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#na.valueOf()})),t.append(e)}const r=this.#ua;if(r)jce.render({xfaHtml:r,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const t=this._formatContents(this.#ta);e.append(t)}this.#me.append(e)}get#ua(){const e=this.#sa,t=this.#ta;return!e?.str||t?.str&&t.str!==e.str?null:this.#sa.html||null}get#ma(){return this.#ua?.attributes?.style?.fontSize||0}get#pa(){return this.#ua?.attributes?.style?.color||null}#va(e){const t=[],n={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},r={style:{color:this.#pa,fontSize:this.#ma?`calc(${this.#ma}px * var(--scale-factor))`:""}};for(const n of e.split("\n"))t.push({name:"span",value:n,attributes:r});return n}_formatContents({str:e,dir:t}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=t;const r=e.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){const a=r[e];n.append(document.createTextNode(a)),e<t-1&&n.append(document.createElement("br"))}return n}#Gr(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||("Enter"===e.key||"Escape"===e.key&&this.#ca)&&this.#Zr()}updateEdited({rect:e,popupContent:t}){this.#Fr||={contentsObj:this.#ta,richText:this.#sa},e&&(this.#L=null),t&&(this.#sa=this.#va(t),this.#ta=null),this.#ia?.remove(),this.#ia=null}resetEdited(){this.#Fr&&(({contentsObj:this.#ta,richText:this.#sa}=this.#Fr),this.#Fr=null,this.#ia?.remove(),this.#ia=null,this.#L=null)}#fa(){if(null!==this.#L)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:r,pageY:a}}}=this.#aa;let o=!!this.#oa,c=o?this.#oa:this.#la;for(const e of this.#ra)if(!c||null!==uae.intersect(e.data.rect,c)){c=e.data.rect,o=!0;break}const i=uae.normalizeRect([c[0],e[3]-c[1]+e[1],c[2],e[3]-c[3]+e[1]]),l=o?c[2]-c[0]+5:0,s=i[0]+l,h=i[1];this.#L=[100*(s-r)/t,100*(h-a)/n];const{style:d}=this.#me;d.left=`${this.#L[0]}%`,d.top=`${this.#L[1]}%`}#Zr(){this.#ca=!this.#ca,this.#ca?(this.#Qr(),this.#me.addEventListener("click",this.#Jr),this.#me.addEventListener("keydown",this.#qr)):(this.#Kr(),this.#me.removeEventListener("click",this.#Jr),this.#me.removeEventListener("keydown",this.#qr))}#Qr(){this.#ia||this.render(),this.isVisible?this.#ca&&this.#me.classList.add("focused"):(this.#fa(),this.#me.hidden=!1,this.#me.style.zIndex=parseInt(this.#me.style.zIndex)+1e3)}#Kr(){this.#me.classList.remove("focused"),!this.#ca&&this.isVisible&&(this.#me.hidden=!0,this.#me.style.zIndex=parseInt(this.#me.style.zIndex)-1e3)}forceHide(){this.#da=this.isVisible,this.#da&&(this.#me.hidden=!0)}maybeShow(){this.#da&&(this.#ia||this.#Qr(),this.#da=!1,this.#me.hidden=!1)}get isVisible(){return!1===this.#me.hidden}}class oie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=Pre.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const n=document.createElement("span");n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class cie extends Gce{#za=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:t,height:n}=$ce(e.rect),r=this.svgFactory.create(t,n,!0),a=this.#za=this.svgFactory.createElement("svg:line");return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#za}addHighlightArea(){this.container.classList.add("highlightArea")}}class iie extends Gce{#ga=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:t,height:n}=$ce(e.rect),r=this.svgFactory.create(t,n,!0),a=e.borderStyle.width,o=this.#ga=this.svgFactory.createElement("svg:rect");return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",t-a),o.setAttribute("height",n-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#ga}addHighlightArea(){this.container.classList.add("highlightArea")}}class lie extends Gce{#ya=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:t,height:n}=$ce(e.rect),r=this.svgFactory.create(t,n,!0),a=e.borderStyle.width,o=this.#ya=this.svgFactory.createElement("svg:ellipse");return o.setAttribute("cx",t/2),o.setAttribute("cy",n/2),o.setAttribute("rx",t/2-a/2),o.setAttribute("ry",n/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#ya}addHighlightArea(){this.container.classList.add("highlightArea")}}class sie extends Gce{#Ma=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:t,borderStyle:n,popupRef:r}}=this;if(!t)return this.container;const{width:a,height:o}=$ce(e),c=this.svgFactory.create(a,o,!0);let i=[];for(let n=0,r=t.length;n<r;n+=2){const r=t[n]-e[0],a=e[3]-t[n+1];i.push(`${r},${a}`)}i=i.join(" ");const l=this.#Ma=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",i),l.setAttribute("stroke-width",n.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),c.append(l),this.container.append(c),!r&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Ma}addHighlightArea(){this.container.classList.add("highlightArea")}}class hie extends sie{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class die extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class uie extends Gce{#Ea=null;#ba=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?Pre.HIGHLIGHT:Pre.INK}#Ha(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:t,inkLists:n,borderStyle:r,popupRef:a}}=this,{transform:o,width:c,height:i}=this.#Ha(t,e),l=this.svgFactory.create(c,i,!0),s=this.#Ea=this.svgFactory.createElement("svg:g");l.append(s),s.setAttribute("stroke-width",r.width||1),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("stroke-miterlimit",10),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),s.setAttribute("transform",o);for(let e=0,t=n.length;e<t;e++){const t=this.svgFactory.createElement(this.svgElementName);this.#ba.push(t),t.setAttribute("points",n[e].join(",")),s.append(t)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:t,points:n,rect:r}=e,a=this.#Ea;if(t>=0&&a.setAttribute("stroke-width",t||1),n)for(let e=0,t=this.#ba.length;e<t;e++)this.#ba[e].setAttribute("points",n[e].join(","));if(r){const{transform:e,width:t,height:n}=this.#Ha(this.data.rotation,r);a.parentElement.setAttribute("viewBox",`0 0 ${t} ${n}`),a.setAttribute("transform",e)}}getElementsToTriggerPopup(){return this.#ba}addHighlightArea(){this.container.classList.add("highlightArea")}}class mie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Pre.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class pie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class vie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class fie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class zie extends Gce{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Pre.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class gie extends Gce{#Va=null;constructor(e){super(e,{isRenderable:!0});const{file:t}=this.data;this.filename=t.filename,this.content=t.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let n;t.hasAppearance||0===t.fillAlpha?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(100*t.fillAlpha)}%);`)),n.addEventListener("dblclick",this.#Ca.bind(this)),this.#Va=n;const{isMac:r}=hae.platform;return e.addEventListener("keydown",(e=>{"Enter"===e.key&&(r?e.metaKey:e.ctrlKey)&&this.#Ca()})),!t.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return this.#Va}addHighlightArea(){this.container.classList.add("highlightArea")}#Ca(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class yie{#La=null;#ka=null;#wa=new Map;#Sa=null;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:r,page:a,viewport:o,structTreeLayer:c}){this.div=e,this.#La=t,this.#ka=n,this.#Sa=c||null,this.page=a,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=r}hasEditableAnnotations(){return this.#wa.size>0}async#xa(e,t){const n=e.firstChild||e,r=n.id=`${fae}${t}`,a=await(this.#Sa?.getAriaAttributes(r));if(a)for(const[e,t]of a)n.setAttribute(e,t);this.div.append(e),this.#La?.moveElementInDOM(this.div,e,n,!1)}async render(e){const{annotations:t}=e,n=this.div;Nae(n,this.viewport);const r=new Map,a={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new Bce,annotationStorage:e.annotationStorage||new toe,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=16===e.annotationType;if(t){const t=r.get(e.id);if(!t)continue;a.elements=t}else{const{width:t,height:n}=$ce(e.rect);if(t<=0||n<=0)continue}a.data=e;const n=qce.create(a);if(!n.isRenderable)continue;if(!t&&e.popupRef){const t=r.get(e.popupRef);t?t.push(n):r.set(e.popupRef,[n])}const o=n.render();e.hidden&&(o.style.visibility="hidden"),await this.#xa(o,e.id),n._isEditable&&(this.#wa.set(n.data.id,n),this._annotationEditorUIManager?.renderAnnotationElement(n))}this.#Ta()}update({viewport:e}){const t=this.div;this.viewport=e,Nae(t,{rotation:e.rotation}),this.#Ta(),t.hidden=!1}#Ta(){if(!this.#ka)return;const e=this.div;for(const[t,n]of this.#ka){const r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;n.className="annotationContent";const{firstChild:a}=r;a?"CANVAS"===a.nodeName?a.replaceWith(n):a.classList.contains("annotationContent")?a.after(n):a.before(n):r.append(n)}this.#ka.clear()}getEditableAnnotations(){return Array.from(this.#wa.values())}getEditableAnnotation(e){return this.#wa.get(e)}}const Mie=/\r\n?|\n/g;class Eie extends Yae{#ea;#Oa="";#Aa=`${this.id}-editor`;#Ra=null;#ma;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=Eie.prototype,t=e=>e.isEmpty(),n=$ae.TRANSLATE_SMALL,r=$ae.TRANSLATE_BIG;return Jre(this,"_keyboardManager",new Uae([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[n,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:t}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,n],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:t}]]))}static _type="freetext";static _editorType=Pre.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"}),this.#ea=e.color||Eie._defaultColor||Yae._defaultLineColor,this.#ma=e.fontSize||Eie._defaultFontSize}static initialize(e,t){Yae.initialize(e,t);const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case Fre.FREETEXT_SIZE:Eie._defaultFontSize=t;break;case Fre.FREETEXT_COLOR:Eie._defaultColor=t}}updateParams(e,t){switch(e){case Fre.FREETEXT_SIZE:this.#Na(t);break;case Fre.FREETEXT_COLOR:this.#_a(t)}}static get defaultPropertiesToUpdate(){return[[Fre.FREETEXT_SIZE,Eie._defaultFontSize],[Fre.FREETEXT_COLOR,Eie._defaultColor||Yae._defaultLineColor]]}get propertiesToUpdate(){return[[Fre.FREETEXT_SIZE,this.#ma],[Fre.FREETEXT_COLOR,this.#ea]]}#Na(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#ma)*this.parentScale),this.#ma=e,this.#Da()},n=this.#ma;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Fre.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#_a(e){const t=e=>{this.#ea=this.editorDiv.style.color=e},n=this.#ea;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Fre.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-Eie._internalPadding*e,-(Eie._internalPadding+this.#ma)*e]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(Pre.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#Ra=new AbortController;const e=this._uiManager.combinedSignal(this.#Ra);this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#Aa),this._isDraggable=!0,this.#Ra?.abort(),this.#Ra=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#Pa(){const e=[];this.editorDiv.normalize();let t=null;for(const n of this.editorDiv.childNodes)t?.nodeType===Node.TEXT_NODE&&"BR"===n.nodeName||(e.push(Eie.#Fa(n)),t=n);return e.join("\n")}#Da(){const[e,t]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:e,div:t}=this,r=t.style.display,a=t.classList.contains("hidden");t.classList.remove("hidden"),t.style.display="hidden",e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r,t.classList.toggle("hidden",a)}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=this.#Oa,t=this.#Oa=this.#Pa().trimEnd();if(e===t)return;const n=e=>{this.#Oa=e,e?(this.#Ia(),this._uiManager.rebuild(this),this.#Da()):this.remove()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#Da()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Eie._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#Aa),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#ma}px * var(--scale-factor))`,n.color=this.#ea,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Fae(this,this.div,["dblclick","keydown"]),this.width){const[n,r]=this.parentDimensions;if(this.annotationElementId){const{position:a}=this._initialData;let[o,c]=this.getInitialTranslation();[o,c]=this.pageTranslationToScreen(o,c);const[i,l]=this.pageDimensions,[s,h]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=e+(a[0]-s)/i,u=t+this.height-(a[1]-h)/l;break;case 90:d=e+(a[0]-s)/i,u=t-(a[1]-h)/l,[o,c]=[c,-o];break;case 180:d=e-this.width+(a[0]-s)/i,u=t-(a[1]-h)/l,[o,c]=[-o,-c];break;case 270:d=e+(a[0]-s-this.height*l)/i,u=t+(a[1]-h-this.width*i)/l,[o,c]=[-c,o]}this.setAt(d*n,u*r,o,c)}else this.setAt(e*n,t*r,this.width*n,this.height*r);this.#Ia(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#Fa(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Mie,"")}editorDivPaste(e){const t=e.clipboardData||window.clipboardData,{types:n}=t;if(1===n.length&&"text/plain"===n[0])return;e.preventDefault();const r=Eie.#Ba(t.getData("text")||"").replaceAll(Mie,"\n");if(!r)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!r.includes("\n"))return o.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),void a.collapseToStart();const{startContainer:c,startOffset:i}=o,l=[],s=[];if(c.nodeType===Node.TEXT_NODE){const e=c.parentElement;if(s.push(c.nodeValue.slice(i).replaceAll(Mie,"")),e!==this.editorDiv){let t=l;for(const n of this.editorDiv.childNodes)n!==e?t.push(Eie.#Fa(n)):t=s}l.push(c.nodeValue.slice(0,i).replaceAll(Mie,""))}else if(c===this.editorDiv){let e=l,t=0;for(const n of this.editorDiv.childNodes)t++===i&&(e=s),e.push(Eie.#Fa(n))}this.#Oa=`${l.join("\n")}${r}${s.join("\n")}`,this.#Ia();const h=new Range;let d=l.reduce(((e,t)=>e+t.length),0);for(const{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){const t=e.nodeValue.length;if(d<=t){h.setStart(e,d),h.setEnd(e,d);break}d-=t}a.removeAllRanges(),a.addRange(h)}#Ia(){if(this.editorDiv.replaceChildren(),this.#Oa)for(const e of this.#Oa.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}#ja(){return this.#Oa.replaceAll(" "," ")}static#Ba(e){return e.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}static async deserialize(e,t,n){let r=null;if(e instanceof oie){const{data:{defaultAppearanceData:{fontSize:t,fontColor:n},rect:a,rotation:o,id:c,popupRef:i},textContent:l,textPosition:s,parent:{page:{pageNumber:h}}}=e;if(!l||0===l.length)return null;r=e={annotationType:Pre.FREETEXT,color:Array.from(n),fontSize:t,value:l.join("\n"),position:s,pageIndex:h-1,rect:a.slice(0),rotation:o,id:c,deleted:!1,popupRef:i}}const a=await super.deserialize(e,t,n);return a.#ma=e.fontSize,a.#ea=uae.makeHexColor(...e.color),a.#Oa=Eie.#Ba(e.value),a.annotationElementId=e.id||null,a._initialData=r,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const t=Eie._internalPadding*this.parentScale,n=this.getRect(t,t),r=Yae._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#ea),a={annotationType:Pre.FREETEXT,color:r,fontSize:this.#ma,value:this.#ja(),pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!this.#Ua(a)?null:(a.id=this.annotationElementId,a)}#Ua(e){const{value:t,fontSize:n,color:r,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some(((e,t)=>e!==r[t]))||e.pageIndex!==a}renderAnnotationElement(e){const t=super.renderAnnotationElement(e);if(this.deleted)return t;const{style:n}=t;n.fontSize=`calc(${this.#ma}px * var(--scale-factor))`,n.color=this.#ea,t.replaceChildren();for(const e of this.#Oa.split("\n")){const n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),t.append(n)}const r=Eie._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(r,r),popupContent:this.#Oa}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}}class bie{static PRECISION=1e-4;toSVGPath(){Kre("Abstract method `toSVGPath` must be implemented.")}get box(){Kre("Abstract getter `box` must be implemented.")}serialize(e,t){Kre("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,r,a,o){o||=new Float32Array(e.length);for(let c=0,i=e.length;c<i;c+=2)o[c]=t+e[c]*r,o[c+1]=n+e[c+1]*a;return o}static _rescaleAndSwap(e,t,n,r,a,o){o||=new Float32Array(e.length);for(let c=0,i=e.length;c<i;c+=2)o[c]=t+e[c+1]*r,o[c+1]=n+e[c]*a;return o}static _translate(e,t,n,r){r||=new Float32Array(e.length);for(let a=0,o=e.length;a<o;a+=2)r[a]=t+e[a],r[a+1]=n+e[a+1];return r}static svgRound(e){return Math.round(1e4*e)}static _normalizePoint(e,t,n,r,a){switch(a){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static _normalizePagePoint(e,t,n){switch(n){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,n,r,a,o){return[(e+5*n)/6,(t+5*r)/6,(5*n+a)/6,(5*r+o)/6,(n+a)/2,(r+o)/2]}}class Hie{#Wa;#$a=[];#qa;#Ga;#Ya=[];#Ka=new Float32Array(18);#Xa;#Qa;#Ja;#Za;#eo;#to;#no=[];static#ro=8;static#ao=2;static#oo=Hie.#ro+Hie.#ao;constructor({x:e,y:t},n,r,a,o,c=0){this.#Wa=n,this.#to=a*r,this.#Ga=o,this.#Ka.set([NaN,NaN,NaN,NaN,e,t],6),this.#qa=c,this.#Za=Hie.#ro*r,this.#Ja=Hie.#oo*r,this.#eo=r,this.#no.push(e,t)}isEmpty(){return isNaN(this.#Ka[8])}#co(){const e=this.#Ka.subarray(4,6),t=this.#Ka.subarray(16,18),[n,r,a,o]=this.#Wa;return[(this.#Xa+(e[0]-t[0])/2-n)/a,(this.#Qa+(e[1]-t[1])/2-r)/o,(this.#Xa+(t[0]-e[0])/2-n)/a,(this.#Qa+(t[1]-e[1])/2-r)/o]}add({x:e,y:t}){this.#Xa=e,this.#Qa=t;const[n,r,a,o]=this.#Wa;let[c,i,l,s]=this.#Ka.subarray(8,12);const h=e-l,d=t-s,u=Math.hypot(h,d);if(u<this.#Ja)return!1;const m=u-this.#Za,p=m/u,v=p*h,f=p*d;let z=c,g=i;c=l,i=s,l+=v,s+=f,this.#no?.push(e,t);const y=v/m,M=-f/m*this.#to,E=y*this.#to;return this.#Ka.set(this.#Ka.subarray(2,8),0),this.#Ka.set([l+M,s+E],4),this.#Ka.set(this.#Ka.subarray(14,18),12),this.#Ka.set([l-M,s-E],16),isNaN(this.#Ka[6])?(0===this.#Ya.length&&(this.#Ka.set([c+M,i+E],2),this.#Ya.push(NaN,NaN,NaN,NaN,(c+M-n)/a,(i+E-r)/o),this.#Ka.set([c-M,i-E],14),this.#$a.push(NaN,NaN,NaN,NaN,(c-M-n)/a,(i-E-r)/o)),this.#Ka.set([z,g,c,i,l,s],6),!this.isEmpty()):(this.#Ka.set([z,g,c,i,l,s],6),Math.abs(Math.atan2(g-i,z-c)-Math.atan2(f,v))<Math.PI/2?([c,i,l,s]=this.#Ka.subarray(2,6),this.#Ya.push(NaN,NaN,NaN,NaN,((c+l)/2-n)/a,((i+s)/2-r)/o),[c,i,z,g]=this.#Ka.subarray(14,18),this.#$a.push(NaN,NaN,NaN,NaN,((z+c)/2-n)/a,((g+i)/2-r)/o),!0):([z,g,c,i,l,s]=this.#Ka.subarray(0,6),this.#Ya.push(((z+5*c)/6-n)/a,((g+5*i)/6-r)/o,((5*c+l)/6-n)/a,((5*i+s)/6-r)/o,((c+l)/2-n)/a,((i+s)/2-r)/o),[l,s,c,i,z,g]=this.#Ka.subarray(12,18),this.#$a.push(((z+5*c)/6-n)/a,((g+5*i)/6-r)/o,((5*c+l)/6-n)/a,((5*i+s)/6-r)/o,((c+l)/2-n)/a,((i+s)/2-r)/o),!0))}toSVGPath(){if(this.isEmpty())return"";const e=this.#Ya,t=this.#$a;if(isNaN(this.#Ka[6])&&!this.isEmpty())return this.#io();const n=[];n.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?n.push(`L${e[t+4]} ${e[t+5]}`):n.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#lo(n);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#so(n),n.join(" ")}#io(){const[e,t,n,r]=this.#Wa,[a,o,c,i]=this.#co();return`M${(this.#Ka[2]-e)/n} ${(this.#Ka[3]-t)/r} L${(this.#Ka[4]-e)/n} ${(this.#Ka[5]-t)/r} L${a} ${o} L${c} ${i} L${(this.#Ka[16]-e)/n} ${(this.#Ka[17]-t)/r} L${(this.#Ka[14]-e)/n} ${(this.#Ka[15]-t)/r} Z`}#so(e){const t=this.#$a;e.push(`L${t[4]} ${t[5]} Z`)}#lo(e){const[t,n,r,a]=this.#Wa,o=this.#Ka.subarray(4,6),c=this.#Ka.subarray(16,18),[i,l,s,h]=this.#co();e.push(`L${(o[0]-t)/r} ${(o[1]-n)/a} L${i} ${l} L${s} ${h} L${(c[0]-t)/r} ${(c[1]-n)/a}`)}newFreeDrawOutline(e,t,n,r,a,o){return new Vie(e,t,n,r,a,o)}getOutlines(){const e=this.#Ya,t=this.#$a,n=this.#Ka,[r,a,o,c]=this.#Wa,i=new Float32Array((this.#no?.length??0)+2);for(let e=0,t=i.length-2;e<t;e+=2)i[e]=(this.#no[e]-r)/o,i[e+1]=(this.#no[e+1]-a)/c;if(i[i.length-2]=(this.#Xa-r)/o,i[i.length-1]=(this.#Qa-a)/c,isNaN(n[6])&&!this.isEmpty())return this.#ho(i);const l=new Float32Array(this.#Ya.length+24+this.#$a.length);let s=e.length;for(let t=0;t<s;t+=2)isNaN(e[t])?l[t]=l[t+1]=NaN:(l[t]=e[t],l[t+1]=e[t+1]);s=this.#do(l,s);for(let e=t.length-6;e>=6;e-=6)for(let n=0;n<6;n+=2)isNaN(t[e+n])?(l[s]=l[s+1]=NaN,s+=2):(l[s]=t[e+n],l[s+1]=t[e+n+1],s+=2);return this.#uo(l,s),this.newFreeDrawOutline(l,i,this.#Wa,this.#eo,this.#qa,this.#Ga)}#ho(e){const t=this.#Ka,[n,r,a,o]=this.#Wa,[c,i,l,s]=this.#co(),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(t[2]-n)/a,(t[3]-r)/o,NaN,NaN,NaN,NaN,(t[4]-n)/a,(t[5]-r)/o,NaN,NaN,NaN,NaN,c,i,NaN,NaN,NaN,NaN,l,s,NaN,NaN,NaN,NaN,(t[16]-n)/a,(t[17]-r)/o,NaN,NaN,NaN,NaN,(t[14]-n)/a,(t[15]-r)/o],0),this.newFreeDrawOutline(h,e,this.#Wa,this.#eo,this.#qa,this.#Ga)}#uo(e,t){const n=this.#$a;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+6}#do(e,t){const n=this.#Ka.subarray(4,6),r=this.#Ka.subarray(16,18),[a,o,c,i]=this.#Wa,[l,s,h,d]=this.#co();return e.set([NaN,NaN,NaN,NaN,(n[0]-a)/c,(n[1]-o)/i,NaN,NaN,NaN,NaN,l,s,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(r[0]-a)/c,(r[1]-o)/i],t),t+24}}class Vie extends bie{#Wa;#mo=new Float32Array(4);#qa;#Ga;#no;#eo;#po;constructor(e,t,n,r,a,o){super(),this.#po=e,this.#no=t,this.#Wa=n,this.#eo=r,this.#qa=a,this.#Ga=o,this.lastPoint=[NaN,NaN],this.#vo(o);const[c,i,l,s]=this.#mo;for(let t=0,n=e.length;t<n;t+=2)e[t]=(e[t]-c)/l,e[t+1]=(e[t+1]-i)/s;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-c)/l,t[e+1]=(t[e+1]-i)/s}toSVGPath(){const e=[`M${this.#po[4]} ${this.#po[5]}`];for(let t=6,n=this.#po.length;t<n;t+=6)isNaN(this.#po[t])?e.push(`L${this.#po[t+4]} ${this.#po[t+5]}`):e.push(`C${this.#po[t]} ${this.#po[t+1]} ${this.#po[t+2]} ${this.#po[t+3]} ${this.#po[t+4]} ${this.#po[t+5]}`);return e.push("Z"),e.join(" ")}serialize([e,t,n,r],a){const o=n-e,c=r-t;let i,l;switch(a){case 0:i=bie._rescale(this.#po,e,r,o,-c),l=bie._rescale(this.#no,e,r,o,-c);break;case 90:i=bie._rescaleAndSwap(this.#po,e,t,o,c),l=bie._rescaleAndSwap(this.#no,e,t,o,c);break;case 180:i=bie._rescale(this.#po,n,t,-o,c),l=bie._rescale(this.#no,n,t,-o,c);break;case 270:i=bie._rescaleAndSwap(this.#po,n,r,-o,-c),l=bie._rescaleAndSwap(this.#no,n,r,-o,-c)}return{outline:Array.from(i),points:[Array.from(l)]}}#vo(e){const t=this.#po;let n=t[4],r=t[5],a=n,o=r,c=n,i=r,l=n,s=r;const h=e?Math.max:Math.min;for(let e=6,d=t.length;e<d;e+=6){if(isNaN(t[e]))a=Math.min(a,t[e+4]),o=Math.min(o,t[e+5]),c=Math.max(c,t[e+4]),i=Math.max(i,t[e+5]),s<t[e+5]?(l=t[e+4],s=t[e+5]):s===t[e+5]&&(l=h(l,t[e+4]));else{const d=uae.bezierBoundingBox(n,r,...t.slice(e,e+6));a=Math.min(a,d[0]),o=Math.min(o,d[1]),c=Math.max(c,d[2]),i=Math.max(i,d[3]),s<d[3]?(l=d[2],s=d[3]):s===d[3]&&(l=h(l,d[2]))}n=t[e+4],r=t[e+5]}const d=this.#mo;d[0]=a-this.#qa,d[1]=o-this.#qa,d[2]=c-a+2*this.#qa,d[3]=i-o+2*this.#qa,this.lastPoint=[l,s]}get box(){return this.#mo}newOutliner(e,t,n,r,a,o=0){return new Hie(e,t,n,r,a,o)}getNewOutline(e,t){const[n,r,a,o]=this.#mo,[c,i,l,s]=this.#Wa,h=a*l,d=o*s,u=n*l+c,m=r*s+i,p=this.newOutliner({x:this.#no[0]*h+u,y:this.#no[1]*d+m},this.#Wa,this.#eo,e,this.#Ga,t??this.#qa);for(let e=2;e<this.#no.length;e+=2)p.add({x:this.#no[e]*h+u,y:this.#no[e+1]*d+m});return p.getOutlines()}}class Cie{#Wa;#fo;#zo=[];#go=[];constructor(e,t=0,n=0,r=!0){let a=1/0,o=-1/0,c=1/0,i=-1/0;const l=10**-4;for(const{x:n,y:r,width:s,height:h}of e){const e=Math.floor((n-t)/l)*l,d=Math.ceil((n+s+t)/l)*l,u=Math.floor((r-t)/l)*l,m=Math.ceil((r+h+t)/l)*l,p=[e,u,m,!0],v=[d,u,m,!1];this.#zo.push(p,v),a=Math.min(a,e),o=Math.max(o,d),c=Math.min(c,u),i=Math.max(i,m)}const s=o-a+2*n,h=i-c+2*n,d=a-n,u=c-n,m=this.#zo.at(r?-1:-2),p=[m[0],m[2]];for(const e of this.#zo){const[t,n,r]=e;e[0]=(t-d)/s,e[1]=(n-u)/h,e[2]=(r-u)/h}this.#Wa=new Float32Array([d,u,s,h]),this.#fo=p}getOutlines(){this.#zo.sort(((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]));const e=[];for(const t of this.#zo)t[3]?(e.push(...this.#yo(t)),this.#Mo(t)):(this.#Eo(t),e.push(...this.#yo(t)));return this.#bo(e)}#bo(e){const t=[],n=new Set;for(const n of e){const[e,r,a]=n;t.push([e,r,n],[e,a,n])}t.sort(((e,t)=>e[1]-t[1]||e[0]-t[0]));for(let e=0,r=t.length;e<r;e+=2){const r=t[e][2],a=t[e+1][2];r.push(a),a.push(r),n.add(r),n.add(a)}const r=[];let a;for(;n.size>0;){const e=n.values().next().value;let[t,o,c,i,l]=e;n.delete(e);let s=t,h=o;for(a=[t,c],r.push(a);;){let e;if(n.has(i))e=i;else{if(!n.has(l))break;e=l}n.delete(e),[t,o,c,i,l]=e,s!==t&&(a.push(s,h,t,h===o?o:c),s=t),h=h===o?c:o}a.push(s,h)}return new Lie(r,this.#Wa,this.#fo)}#Ho(e){const t=this.#go;let n=0,r=t.length-1;for(;n<=r;){const a=n+r>>1,o=t[a][0];if(o===e)return a;o<e?n=a+1:r=a-1}return r+1}#Mo([,e,t]){const n=this.#Ho(e);this.#go.splice(n,0,[e,t])}#Eo([,e,t]){const n=this.#Ho(e);for(let r=n;r<this.#go.length;r++){const[n,a]=this.#go[r];if(n!==e)break;if(n===e&&a===t)return void this.#go.splice(r,1)}for(let r=n-1;r>=0;r--){const[n,a]=this.#go[r];if(n!==e)break;if(n===e&&a===t)return void this.#go.splice(r,1)}}#yo(e){const[t,n,r]=e,a=[[t,n,r]],o=this.#Ho(r);for(let e=0;e<o;e++){const[n,r]=this.#go[e];for(let e=0,o=a.length;e<o;e++){const[,c,i]=a[e];if(!(r<=c||i<=n))if(c>=n)if(i>r)a[e][1]=r;else{if(1===o)return[];a.splice(e,1),e--,o--}else a[e][2]=n,i>r&&a.push([t,r,i])}}return a}}class Lie extends bie{#Wa;#Vo;constructor(e,t,n){super(),this.#Vo=e,this.#Wa=t,this.lastPoint=n}toSVGPath(){const e=[];for(const t of this.#Vo){let[n,r]=t;e.push(`M${n} ${r}`);for(let a=2;a<t.length;a+=2){const o=t[a],c=t[a+1];o===n?(e.push(`V${c}`),r=c):c===r&&(e.push(`H${o}`),n=o)}e.push("Z")}return e.join(" ")}serialize([e,t,n,r],a){const o=[],c=n-e,i=r-t;for(const t of this.#Vo){const n=new Array(t.length);for(let a=0;a<t.length;a+=2)n[a]=e+t[a]*c,n[a+1]=r-t[a+1]*i;o.push(n)}return o}get box(){return this.#Wa}get classNamesForOutlining(){return["highlightOutline"]}}class kie extends Hie{newFreeDrawOutline(e,t,n,r,a,o){return new wie(e,t,n,r,a,o)}}class wie extends Vie{newOutliner(e,t,n,r,a,o=0){return new kie(e,t,n,r,a,o)}}class Sie{#Co=null;#Lo=null;#ko;#wo=null;#So=!1;#xo=!1;#o=null;#To;#Oo=null;#v=null;#Ao;static#Ro=null;static get _keyboardManager(){return Jre(this,"_keyboardManager",new Uae([[["Escape","mac+Escape"],Sie.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Sie.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Sie.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Sie.prototype._moveToPrevious],[["Home","mac+Home"],Sie.prototype._moveToBeginning],[["End","mac+End"],Sie.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:t=null}){e?(this.#xo=!1,this.#Ao=Fre.HIGHLIGHT_COLOR,this.#o=e):(this.#xo=!0,this.#Ao=Fre.HIGHLIGHT_DEFAULT_COLOR),this.#v=e?._uiManager||t,this.#To=this.#v._eventBus,this.#ko=e?.color||this.#v?.highlightColors.values().next().value||"#FFFF98",Sie.#Ro||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const e=this.#Co=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=this.#v._signal;e.addEventListener("click",this.#No.bind(this),{signal:t}),e.addEventListener("keydown",this.#Gr.bind(this),{signal:t});const n=this.#Lo=document.createElement("span");return n.className="swatch",n.setAttribute("aria-hidden",!0),n.style.backgroundColor=this.#ko,e.append(n),e}renderMainDropdown(){const e=this.#wo=this.#_o();return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}#_o(){const e=document.createElement("div"),t=this.#v._signal;e.addEventListener("contextmenu",wae,{signal:t}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[n,r]of this.#v.highlightColors){const a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",r),a.title=n,a.setAttribute("data-l10n-id",Sie.#Ro[n]);const o=document.createElement("span");a.append(o),o.className="swatch",o.style.backgroundColor=r,a.setAttribute("aria-selected",r===this.#ko),a.addEventListener("click",this.#Do.bind(this,r),{signal:t}),e.append(a)}return e.addEventListener("keydown",this.#Gr.bind(this),{signal:t}),e}#Do(e,t){t.stopPropagation(),this.#To.dispatch("switchannotationeditorparams",{source:this,type:this.#Ao,value:e})}_colorSelectFromKeyboard(e){if(e.target===this.#Co)return void this.#No(e);const t=e.target.getAttribute("data-color");t&&this.#Do(t,e)}_moveToNext(e){this.#Po?e.target!==this.#Co?e.target.nextSibling?.focus():this.#wo.firstChild?.focus():this.#No(e)}_moveToPrevious(e){e.target!==this.#wo?.firstChild&&e.target!==this.#Co?(this.#Po||this.#No(e),e.target.previousSibling?.focus()):this.#Po&&this._hideDropdownFromKeyboard()}_moveToBeginning(e){this.#Po?this.#wo.firstChild?.focus():this.#No(e)}_moveToEnd(e){this.#Po?this.#wo.lastChild?.focus():this.#No(e)}#Gr(e){Sie._keyboardManager.exec(this,e)}#No(e){if(this.#Po)return void this.hideDropdown();if(this.#So=0===e.detail,this.#Oo||(this.#Oo=new AbortController,window.addEventListener("pointerdown",this.#s.bind(this),{signal:this.#v.combinedSignal(this.#Oo)})),this.#wo)return void this.#wo.classList.remove("hidden");const t=this.#wo=this.#_o();this.#Co.append(t)}#s(e){this.#wo?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#wo?.classList.add("hidden"),this.#Oo?.abort(),this.#Oo=null}get#Po(){return this.#wo&&!this.#wo.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#xo||(this.#Po?(this.hideDropdown(),this.#Co.focus({preventScroll:!0,focusVisible:this.#So})):this.#o?.unselect())}updateColor(e){if(this.#Lo&&(this.#Lo.style.backgroundColor=e),!this.#wo)return;const t=this.#v.highlightColors.values();for(const n of this.#wo.children)n.setAttribute("aria-selected",t.next().value===e)}destroy(){this.#Co?.remove(),this.#Co=null,this.#Lo=null,this.#wo?.remove(),this.#wo=null}}class xie extends Yae{#Fo=null;#Io=0;#Bo;#jo=null;#a=null;#Uo=null;#Wo=null;#$o=0;#qo=null;#Go=null;#y=null;#Yo=!1;#fo=null;#Ko;#Xo=null;#Qo="";#to;#Jo="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=Pre.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const e=xie.prototype;return Jre(this,"_keyboardManager",new Uae([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:"highlightEditor"}),this.color=e.color||xie._defaultColor,this.#to=e.thickness||xie._defaultThickness,this.#Ko=e.opacity||xie._defaultOpacity,this.#Bo=e.boxes||null,this.#Jo=e.methodOfCreation||"",this.#Qo=e.text||"",this._isDraggable=!1,e.highlightId>-1?(this.#Yo=!0,this.#Zo(e),this.#ec()):this.#Bo&&(this.#Fo=e.anchorNode,this.#Io=e.anchorOffset,this.#Wo=e.focusNode,this.#$o=e.focusOffset,this.#tc(),this.#ec(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#Yo?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#to,methodOfCreation:this.#Jo}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}#tc(){const e=new Cie(this.#Bo,.001);this.#Go=e.getOutlines(),[this.x,this.y,this.width,this.height]=this.#Go.box;const t=new Cie(this.#Bo,.0025,.001,"ltr"===this._uiManager.direction);this.#Uo=t.getOutlines();const{lastPoint:n}=this.#Uo;this.#fo=[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height]}#Zo({highlightOutlines:e,highlightId:t,clipPathId:n}){if(this.#Go=e,this.#Uo=e.getNewOutline(this.#to/2+1.5,.0025),t>=0)this.#y=t,this.#jo=n,this.parent.drawLayer.finalizeDraw(t,{bbox:e.box,path:{d:e.toSVGPath()}}),this.#Xo=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#Uo.box,path:{d:this.#Uo.toSVGPath()}},!0);else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#y,{bbox:xie.#nc(this.#Go.box,(t-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#Xo,{bbox:xie.#nc(this.#Uo.box,t),path:{d:this.#Uo.toSVGPath()}})}const[r,a,o,c]=e.box;switch(this.rotation){case 0:this.x=r,this.y=a,this.width=o,this.height=c;break;case 90:{const[e,t]=this.parentDimensions;this.x=a,this.y=1-r,this.width=o*t/e,this.height=c*e/t;break}case 180:this.x=1-r,this.y=1-a,this.width=o,this.height=c;break;case 270:{const[e,t]=this.parentDimensions;this.x=1-a,this.y=r,this.width=o*t/e,this.height=c*e/t;break}}const{lastPoint:i}=this.#Uo;this.#fo=[(i[0]-r)/o,(i[1]-a)/c]}static initialize(e,t){Yae.initialize(e,t),xie._defaultColor||=t.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(e,t){switch(e){case Fre.HIGHLIGHT_DEFAULT_COLOR:xie._defaultColor=t;break;case Fre.HIGHLIGHT_THICKNESS:xie._defaultThickness=t}}translateInPage(e,t){}get toolbarPosition(){return this.#fo}updateParams(e,t){switch(e){case Fre.HIGHLIGHT_COLOR:this.#_a(t);break;case Fre.HIGHLIGHT_THICKNESS:this.#rc(t)}}static get defaultPropertiesToUpdate(){return[[Fre.HIGHLIGHT_DEFAULT_COLOR,xie._defaultColor],[Fre.HIGHLIGHT_THICKNESS,xie._defaultThickness]]}get propertiesToUpdate(){return[[Fre.HIGHLIGHT_COLOR,this.color||xie._defaultColor],[Fre.HIGHLIGHT_THICKNESS,this.#to||xie._defaultThickness],[Fre.HIGHLIGHT_FREE,this.#Yo]]}#_a(e){const t=(e,t)=>{this.color=e,this.#Ko=t,this.parent?.drawLayer.updateProperties(this.#y,{root:{fill:e,"fill-opacity":t}}),this.#a?.updateColor(e)},n=this.color,r=this.#Ko;this.addCommands({cmd:t.bind(this,e,xie._defaultOpacity),undo:t.bind(this,n,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Fre.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)}#rc(e){const t=this.#to,n=e=>{this.#to=e,this.#ac(e)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Fre.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(this.#a=new Sie({editor:this}),e.addColorPicker(this.#a)),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#oc())}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,this.#oc())}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this.#cc(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#ec(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?this.#cc():e&&(this.#ec(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),t&&this.select()}#ac(e){if(!this.#Yo)return;this.#Zo({highlightOutlines:this.#Go.getNewOutline(e/2)}),this.fixAndSetPosition();const[t,n]=this.parentDimensions;this.setDims(this.width*t,this.height*n)}#cc(){null!==this.#y&&this.parent&&(this.parent.drawLayer.remove(this.#y),this.#y=null,this.parent.drawLayer.remove(this.#Xo),this.#Xo=null)}#ec(e=this.parent){null===this.#y&&(({id:this.#y,clipPathId:this.#jo}=e.drawLayer.draw({bbox:this.#Go.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.#Ko},rootClass:{highlight:!0,free:this.#Yo},path:{d:this.#Go.toSVGPath()}},!1,!0)),this.#Xo=e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#Yo},bbox:this.#Uo.box,path:{d:this.#Uo.toSVGPath()}},this.#Yo),this.#qo&&(this.#qo.style.clipPath=this.#jo))}static#nc([e,t,n,r],a){switch(a){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}rotate(e){const{drawLayer:t}=this.parent;let n;this.#Yo?(e=(e-this.rotation+360)%360,n=xie.#nc(this.#Go.box,e)):n=xie.#nc([this.x,this.y,this.width,this.height],e),t.updateProperties(this.#y,{bbox:n,root:{"data-main-rotation":e}}),t.updateProperties(this.#Xo,{bbox:xie.#nc(this.#Uo.box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();this.#Qo&&(e.setAttribute("aria-label",this.#Qo),e.setAttribute("role","mark")),this.#Yo?e.classList.add("free"):this.div.addEventListener("keydown",this.#ic.bind(this),{signal:this._uiManager._signal});const t=this.#qo=document.createElement("div");e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal",t.style.clipPath=this.#jo;const[n,r]=this.parentDimensions;return this.setDims(this.width*n,this.height*r),Fae(this,this.#qo,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#Xo,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#Xo,{rootClass:{hovered:!1}})}#ic(e){xie._keyboardManager.exec(this,e)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#lc(!0);break;case 1:case 3:this.#lc(!1)}}#lc(e){if(!this.#Fo)return;const t=window.getSelection();e?t.setPosition(this.#Fo,this.#Io):t.setPosition(this.#Wo,this.#$o)}select(){super.select(),this.#Xo&&this.parent?.drawLayer.updateProperties(this.#Xo,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#Xo&&(this.parent?.drawLayer.updateProperties(this.#Xo,{rootClass:{selected:!1}}),this.#Yo||this.#lc(!1))}get _mustFixPosition(){return!this.#Yo}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(this.#y,{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(this.#Xo,{rootClass:{hidden:!e}}))}#oc(){return this.#Yo?this.rotation:0}#sc(){if(this.#Yo)return null;const[e,t]=this.pageDimensions,[n,r]=this.pageTranslation,a=this.#Bo,o=new Float32Array(8*a.length);let c=0;for(const{x:i,y:l,width:s,height:h}of a){const a=i*e+n,d=(1-l)*t+r;o[c]=o[c+4]=a,o[c+1]=o[c+3]=d,o[c+2]=o[c+6]=a+s*e,o[c+5]=o[c+7]=d-h*t,c+=8}return o}#hc(e){return this.#Go.serialize(e,this.#oc())}static startHighlighting(e,t,{target:n,x:r,y:a}){const{x:o,y:c,width:i,height:l}=n.getBoundingClientRect(),s=new AbortController,h=e.combinedSignal(s),d=t=>{s.abort(),this.#dc(e,t)};window.addEventListener("blur",d,{signal:h}),window.addEventListener("pointerup",d,{signal:h}),window.addEventListener("pointerdown",Sae,{capture:!0,passive:!1,signal:h}),window.addEventListener("contextmenu",wae,{signal:h}),n.addEventListener("pointermove",this.#uc.bind(this,e),{signal:h}),this._freeHighlight=new kie({x:r,y:a},[o,c,i,l],e.scale,this._defaultThickness/2,t,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0))}static#uc(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#dc(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(e,t,n){let r=null;if(e instanceof mie){const{data:{quadPoints:t,rect:n,rotation:a,id:o,color:c,opacity:i,popupRef:l},parent:{page:{pageNumber:s}}}=e;r=e={annotationType:Pre.HIGHLIGHT,color:Array.from(c),opacity:i,quadPoints:t,boxes:null,pageIndex:s-1,rect:n.slice(0),rotation:a,id:o,deleted:!1,popupRef:l}}else if(e instanceof uie){const{data:{inkLists:t,rect:n,rotation:a,id:o,color:c,borderStyle:{rawWidth:i},popupRef:l},parent:{page:{pageNumber:s}}}=e;r=e={annotationType:Pre.HIGHLIGHT,color:Array.from(c),thickness:i,inkLists:t,boxes:null,pageIndex:s-1,rect:n.slice(0),rotation:a,id:o,deleted:!1,popupRef:l}}const{color:a,quadPoints:o,inkLists:c,opacity:i}=e,l=await super.deserialize(e,t,n);l.color=uae.makeHexColor(...a),l.#Ko=i||1,c&&(l.#to=e.thickness),l.annotationElementId=e.id||null,l._initialData=r;const[s,h]=l.pageDimensions,[d,u]=l.pageTranslation;if(o){const e=l.#Bo=[];for(let t=0;t<o.length;t+=8)e.push({x:(o[t]-d)/s,y:1-(o[t+1]-u)/h,width:(o[t+2]-o[t])/s,height:(o[t+1]-o[t+5])/h});l.#tc(),l.#ec(),l.rotate(l.rotation)}else if(c){l.#Yo=!0;const e=c[0],n={x:e[0]-d,y:h-(e[1]-u)},r=new kie(n,[0,0,s,h],1,l.#to/2,!0,.001);for(let t=0,a=e.length;t<a;t+=2)n.x=e[t]-d,n.y=h-(e[t+1]-u),r.add(n);const{id:a,clipPathId:o}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:l.color,"fill-opacity":l._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:r.toSVGPath()}},!0,!0);l.#Zo({highlightOutlines:r.getOutlines(),highlightId:a,clipPathId:o}),l.#ec()}return l}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const t=this.getRect(0,0),n=Yae._colorManager.convert(this.color),r={annotationType:Pre.HIGHLIGHT,color:n,opacity:this.#Ko,thickness:this.#to,quadPoints:this.#sc(),outlines:this.#hc(t),pageIndex:this.pageIndex,rect:t,rotation:this.#oc(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#Ua(r)?null:(r.id=this.annotationElementId,r)}#Ua(e){const{color:t}=this._initialData;return e.color.some(((e,n)=>e!==t[n]))}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class Tie{#mc=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,n]of Object.entries(e))this.updateProperty(t,n)}updateSVGProperty(e,t){this.#mc[e]=t}toSVGProperties(){const e=this.#mc;return this.#mc=Object.create(null),{root:e}}reset(){this.#mc=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){Kre("Not implemented")}}class Oie extends Yae{#pc=null;#vc;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#fc=null;static#zc=null;static#gc=null;static#yc=NaN;static#Mc=null;static#Ec=null;static#bc=NaN;static _INNER_MARGIN=3;constructor(e){super(e),this.#vc=e.mustBeCommitted||!1,e.drawOutlines&&(this.#Hc(e),this.#ec())}#Hc({drawOutlines:e,drawId:t,drawingOptions:n}){this.#pc=e,this._drawingOptions||=n,t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties)):this._drawId=this.#Vc(e,this.parent),this.#Cc(e.box)}#Vc(e,t){const{id:n}=t.drawLayer.draw(Oie._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n}static _mergeSVGProperties(e,t){const n=new Set(Object.keys(e));for(const[r,a]of Object.entries(t))n.has(r)?Object.assign(e[r],a):e[r]=a;return e}static getDefaultDrawingOptions(e){Kre("Not implemented")}static get typesMap(){Kre("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){const n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,t),this._currentParent&&(Oie.#fc.updateProperty(n,t),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){const n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){const e=[],t=this._defaultDrawingOptions;for(const[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:t}=this;for(const[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,n){const r=this._drawingOptions,a=r[t],o=e=>{r.updateProperty(t,e);const n=this.#pc.updateProperty(t,e);n&&this.#Cc(n),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties())};this.addCommands({cmd:o.bind(this,n),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Oie._mergeSVGProperties(this.#pc.getPathResizingSVGProperties(this.#Lc()),{bbox:this.#kc()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Oie._mergeSVGProperties(this.#pc.getPathResizedSVGProperties(this.#Lc()),{bbox:this.#kc()}))}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#kc(e,t)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Oie._mergeSVGProperties(this.#pc.getPathTranslatedSVGProperties(this.#Lc(),this.parentDimensions),{bbox:this.#kc()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#vc&&(this.#vc=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this.#cc(),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#ec(),this.#Cc(this.#pc.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#cc()):e&&(this._uiManager.addShouldRescale(this),this.#ec(e),t=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),t&&this.select()}#cc(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#ec(e=this.parent){null!==this._drawId&&this.parent===e||(null===this._drawId?(this._drawingOptions.updateAll(),this._drawId=this.#Vc(this.#pc,e)):this.parent.drawLayer.updateParent(this._drawId,e.drawLayer))}#wc([e,t,n,r]){const{parentDimensions:[a,o],rotation:c}=this;switch(c){case 90:return[t,1-e,n*(o/a),r*(a/o)];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,n*(o/a),r*(a/o)];default:return[e,t,n,r]}}#Lc(){const{x:e,y:t,width:n,height:r,parentDimensions:[a,o],rotation:c}=this;switch(c){case 90:return[1-t,e,n*(a/o),r*(o/a)];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,n*(a/o),r*(o/a)];default:return[e,t,n,r]}}#Cc(e){if([this.x,this.y,this.width,this.height]=this.#wc(e),this.div){this.fixAndSetPosition();const[e,t]=this.parentDimensions;this.setDims(this.width*e,this.height*t)}this._onResized()}#kc(){const{x:e,y:t,width:n,height:r,rotation:a,parentRotation:o,parentDimensions:[c,i]}=this;switch((4*a+o)/90){case 1:return[1-t-r,e,r,n];case 2:return[1-e-n,1-t-r,n,r];case 3:return[t,1-e-n,r,n];case 4:return[e,t-n*(c/i),r*(i/c),n*(c/i)];case 5:return[1-t,e,n*(c/i),r*(i/c)];case 6:return[1-e-r*(i/c),1-t,r*(i/c),n*(c/i)];case 7:return[t-n*(c/i),1-e-r*(i/c),n*(c/i),r*(i/c)];case 8:return[e-n,t-r,n,r];case 9:return[1-t,e-n,r,n];case 10:return[1-e,1-t,n,r];case 11:return[t-r,1-e,r,n];case 12:return[e-r*(i/c),t,r*(i/c),n*(c/i)];case 13:return[1-t-n*(c/i),e-r*(i/c),n*(c/i),r*(i/c)];case 14:return[1-e,1-t-n*(c/i),r*(i/c),n*(c/i)];case 15:return[t,1-e,n*(c/i),r*(i/c)];default:return[e,t,n,r]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,Oie._mergeSVGProperties({bbox:this.#kc()},this.#pc.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#Cc(this.#pc.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;const e=super.render();e.classList.add("draw");const t=document.createElement("div");e.append(t),t.setAttribute("aria-hidden","true"),t.className="internal";const[n,r]=this.parentDimensions;return this.setDims(this.width*n,this.height*r),this._uiManager.addShouldRescale(this),this.disableEditing(),e}static createDrawerInstance(e,t,n,r,a){Kre("Not implemented")}static startDrawing(e,t,n,r){const{target:a,offsetX:o,offsetY:c,pointerId:i,pointerType:l}=r;if(Oie.#Mc&&Oie.#Mc!==l)return;const{viewport:{rotation:s}}=e,{width:h,height:d}=a.getBoundingClientRect(),u=Oie.#zc=new AbortController,m=e.combinedSignal(u);Oie.#yc||=i,Oie.#Mc??=l,window.addEventListener("pointerup",(e=>{Oie.#yc===e.pointerId?this._endDraw(e):Oie.#Ec?.delete(e.pointerId)}),{signal:m}),window.addEventListener("pointercancel",(e=>{Oie.#yc===e.pointerId?this._currentParent.endDrawingSession():Oie.#Ec?.delete(e.pointerId)}),{signal:m}),window.addEventListener("pointerdown",(e=>{Oie.#Mc===e.pointerType&&((Oie.#Ec||=new Set).add(e.pointerId),Oie.#fc.isCancellable()&&(Oie.#fc.removeLastElement(),Oie.#fc.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))}),{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",wae,{signal:m}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),a.addEventListener("touchmove",(e=>{e.timeStamp===Oie.#bc&&Sae(e)}),{signal:m}),e.toggleDrawing(),t._editorUndoBar?.hide(),Oie.#fc?e.drawLayer.updateProperties(this._currentDrawId,Oie.#fc.startNew(o,c,h,d,s)):(t.updateUIForDefaultProperties(this),Oie.#fc=this.createDrawerInstance(o,c,h,d,s),Oie.#gc=this.getDefaultDrawingOptions(),this._currentParent=e,({id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(Oie.#gc.toSVGProperties(),Oie.#fc.defaultSVGProperties),!0,!1)))}static _drawMove(e){if(Oie.#bc=-1,!Oie.#fc)return;const{offsetX:t,offsetY:n,pointerId:r}=e;Oie.#yc===r&&(Oie.#Ec?.size>=1?this._endDraw(e):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,Oie.#fc.add(t,n)),Oie.#bc=e.timeStamp,Sae(e)))}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,Oie.#fc=null,Oie.#gc=null,Oie.#Mc=null,Oie.#bc=NaN),Oie.#zc&&(Oie.#zc.abort(),Oie.#zc=null,Oie.#yc=NaN,Oie.#Ec=null)}static _endDraw(e){const t=this._currentParent;if(t)if(t.toggleDrawing(!0),this._cleanup(!1),e&&t.drawLayer.updateProperties(this._currentDrawId,Oie.#fc.end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const e=Oie.#fc,n=this._currentDrawId,r=e.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(n,e.setLastElement(r))},undo:()=>{t.drawLayer.updateProperties(n,e.removeLastElement())},mustExec:!1,type:Fre.DRAW_STEP})}else this.endDrawing(!1)}static endDrawing(e){const t=this._currentParent;if(!t)return null;if(t.toggleDrawing(!0),t.cleanUndoStack(Fre.DRAW_STEP),!Oie.#fc.isEmpty()){const{pageDimensions:[n,r],scale:a}=t,o=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Oie.#fc.getOutlines(n*a,r*a,a,this._INNER_MARGIN),drawingOptions:Oie.#gc,mustBeCommitted:!e});return this._cleanup(!0),o}return t.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,a,o){Kre("Not implemented")}static async deserialize(e,t,n){const{rawDims:{pageWidth:r,pageHeight:a,pageX:o,pageY:c}}=t.viewport,i=this.deserializeDraw(o,c,r,a,this._INNER_MARGIN,e),l=await super.deserialize(e,t,n);return l.createDrawingOptions(e),l.#Hc({drawOutlines:i}),l.#ec(),l.onScaleChanging(),l.rotate(),l}serializeDraw(e){const[t,n]=this.pageTranslation,[r,a]=this.pageDimensions;return this.#pc.serialize([t,n,r,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class Aie{#Ka=new Float64Array(6);#za;#Sc;#Rn;#to;#no;#xc="";#Tc=0;#Vo=new Rie;#Oc;#Ac;constructor(e,t,n,r,a,o){this.#Oc=n,this.#Ac=r,this.#Rn=a,this.#to=o,[e,t]=this.#Rc(e,t);const c=this.#za=[NaN,NaN,NaN,NaN,e,t];this.#no=[e,t],this.#Sc=[{line:c,points:this.#no}],this.#Ka.set(c,0)}updateProperty(e,t){"stroke-width"===e&&(this.#to=t)}#Rc(e,t){return bie._normalizePoint(e,t,this.#Oc,this.#Ac,this.#Rn)}isEmpty(){return!this.#Sc||0===this.#Sc.length}isCancellable(){return this.#no.length<=10}add(e,t){[e,t]=this.#Rc(e,t);const[n,r,a,o]=this.#Ka.subarray(2,6),c=e-a,i=t-o;return Math.hypot(this.#Oc*c,this.#Ac*i)<=2?null:(this.#no.push(e,t),isNaN(n)?(this.#Ka.set([a,o,e,t],2),this.#za.push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(this.#Ka[0])&&this.#za.splice(6,6),this.#Ka.set([n,r,a,o,e,t],0),this.#za.push(...bie.createBezierPoints(n,r,a,o,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){return this.add(e,t)||(2===this.#no.length?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,n,r,a){this.#Oc=n,this.#Ac=r,this.#Rn=a,[e,t]=this.#Rc(e,t);const o=this.#za=[NaN,NaN,NaN,NaN,e,t];this.#no=[e,t];const c=this.#Sc.at(-1);return c&&(c.line=new Float32Array(c.line),c.points=new Float32Array(c.points)),this.#Sc.push({line:o,points:this.#no}),this.#Ka.set(o,0),this.#Tc=0,this.toSVGPath(),null}getLastElement(){return this.#Sc.at(-1)}setLastElement(e){return this.#Sc?(this.#Sc.push(e),this.#za=e.line,this.#no=e.points,this.#Tc=0,{path:{d:this.toSVGPath()}}):this.#Vo.setLastElement(e)}removeLastElement(){if(!this.#Sc)return this.#Vo.removeLastElement();this.#Sc.pop(),this.#xc="";for(let e=0,t=this.#Sc.length;e<t;e++){const{line:t,points:n}=this.#Sc[e];this.#za=t,this.#no=n,this.#Tc=0,this.toSVGPath()}return{path:{d:this.#xc}}}toSVGPath(){const e=bie.svgRound(this.#za[4]),t=bie.svgRound(this.#za[5]);if(2===this.#no.length)return this.#xc=`${this.#xc} M ${e} ${t} Z`,this.#xc;if(this.#no.length<=6){const n=this.#xc.lastIndexOf("M");this.#xc=`${this.#xc.slice(0,n)} M ${e} ${t}`,this.#Tc=6}if(4===this.#no.length){const e=bie.svgRound(this.#za[10]),t=bie.svgRound(this.#za[11]);return this.#xc=`${this.#xc} L ${e} ${t}`,this.#Tc=12,this.#xc}const n=[];0===this.#Tc&&(n.push(`M ${e} ${t}`),this.#Tc=6);for(let e=this.#Tc,t=this.#za.length;e<t;e+=6){const[t,r,a,o,c,i]=this.#za.slice(e,e+6).map(bie.svgRound);n.push(`C${t} ${r} ${a} ${o} ${c} ${i}`)}return this.#xc+=n.join(" "),this.#Tc=this.#za.length,this.#xc}getOutlines(e,t,n,r){const a=this.#Sc.at(-1);return a.line=new Float32Array(a.line),a.points=new Float32Array(a.points),this.#Vo.build(this.#Sc,e,t,n,this.#Rn,this.#to,r),this.#Ka=null,this.#za=null,this.#Sc=null,this.#xc=null,this.#Vo}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class Rie extends bie{#mo;#Nc=0;#qa;#Sc;#Oc;#Ac;#_c;#Rn;#to;build(e,t,n,r,a,o,c){this.#Oc=t,this.#Ac=n,this.#_c=r,this.#Rn=a,this.#to=o,this.#qa=c??0,this.#Sc=e,this.#Dc()}setLastElement(e){return this.#Sc.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#Sc.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:t}of this.#Sc)if(e.push(`M${bie.svgRound(t[4])} ${bie.svgRound(t[5])}`),6!==t.length)if(12!==t.length)for(let n=6,r=t.length;n<r;n+=6){const[r,a,o,c,i,l]=t.subarray(n,n+6).map(bie.svgRound);e.push(`C${r} ${a} ${o} ${c} ${i} ${l}`)}else e.push(`L${bie.svgRound(t[10])} ${bie.svgRound(t[11])}`);else e.push("Z");return e.join("")}serialize([e,t,n,r],a){const o=[],c=[],[i,l,s,h]=this.#Pc();let d,u,m,p,v,f,z,g,y;switch(this.#Rn){case 0:y=bie._rescale,d=e,u=t+r,m=n,p=-r,v=e+i*n,f=t+(1-l-h)*r,z=e+(i+s)*n,g=t+(1-l)*r;break;case 90:y=bie._rescaleAndSwap,d=e,u=t,m=n,p=r,v=e+l*n,f=t+i*r,z=e+(l+h)*n,g=t+(i+s)*r;break;case 180:y=bie._rescale,d=e+n,u=t,m=-n,p=r,v=e+(1-i-s)*n,f=t+l*r,z=e+(1-i)*n,g=t+(l+h)*r;break;case 270:y=bie._rescaleAndSwap,d=e+n,u=t+r,m=-n,p=-r,v=e+(1-l-h)*n,f=t+(1-i-s)*r,z=e+(1-l)*n,g=t+(1-i)*r}for(const{line:e,points:t}of this.#Sc)o.push(y(e,d,u,m,p,a?new Array(e.length):null)),c.push(y(t,d,u,m,p,a?new Array(t.length):null));return{lines:o,points:c,rect:[v,f,z,g]}}static deserialize(e,t,n,r,a,{paths:{lines:o,points:c},rotation:i,thickness:l}){const s=[];let h,d,u,m,p;switch(i){case 0:p=bie._rescale,h=-e/n,d=t/r+1,u=1/n,m=-1/r;break;case 90:p=bie._rescaleAndSwap,h=-t/r,d=-e/n,u=1/r,m=1/n;break;case 180:p=bie._rescale,h=e/n+1,d=-t/r,u=-1/n,m=1/r;break;case 270:p=bie._rescaleAndSwap,h=t/r+1,d=e/n+1,u=-1/r,m=-1/n}if(!o){o=[];for(const e of c){const t=e.length;if(2===t){o.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(4===t){o.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}const n=new Float32Array(3*(t-2));o.push(n);let[r,a,c,i]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,a],0);for(let o=4;o<t;o+=2){const t=e[o],l=e[o+1];n.set(bie.createBezierPoints(r,a,c,i,t,l),3*(o-2)),[r,a,c,i]=[c,i,t,l]}}}for(let e=0,t=o.length;e<t;e++)s.push({line:p(o[e].map((e=>e??NaN)),h,d,u,m),points:p(c[e].map((e=>e??NaN)),h,d,u,m)});const v=new Rie;return v.build(s,n,r,1,i,l,a),v}#Fc(e=this.#to){const t=this.#qa+e/2*this.#_c;return this.#Rn%180==0?[t/this.#Oc,t/this.#Ac]:[t/this.#Ac,t/this.#Oc]}#Pc(){const[e,t,n,r]=this.#mo,[a,o]=this.#Fc(0);return[e+a,t+o,n-2*a,r-2*o]}#Dc(){const e=this.#mo=new Float32Array([1/0,1/0,-1/0,-1/0]);for(const{line:t}of this.#Sc){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6){const[r,a]=t.subarray(n,n+2);e[0]=Math.min(e[0],r),e[1]=Math.min(e[1],a),e[2]=Math.max(e[2],r),e[3]=Math.max(e[3],a)}continue}let n=t[4],r=t[5];for(let a=6,o=t.length;a<o;a+=6){const[o,c,i,l,s,h]=t.subarray(a,a+6);uae.bezierBoundingBox(n,r,o,c,i,l,s,h,e),n=s,r=h}}const[t,n]=this.#Fc();e[0]=Math.min(1,Math.max(0,e[0]-t)),e[1]=Math.min(1,Math.max(0,e[1]-n)),e[2]=Math.min(1,Math.max(0,e[2]+t)),e[3]=Math.min(1,Math.max(0,e[3]+n)),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#mo}updateProperty(e,t){return"stroke-width"===e?this.#rc(t):null}#rc(e){const[t,n]=this.#Fc();this.#to=e;const[r,a]=this.#Fc(),[o,c]=[r-t,a-n],i=this.#mo;return i[0]-=o,i[1]-=c,i[2]+=2*o,i[3]+=2*c,i}updateParentDimensions([e,t],n){const[r,a]=this.#Fc();this.#Oc=e,this.#Ac=t,this.#_c=n;const[o,c]=this.#Fc(),i=o-r,l=c-a,s=this.#mo;return s[0]-=i,s[1]-=l,s[2]+=2*i,s[3]+=2*l,s}updateRotation(e){return this.#Nc=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#mo.map(bie.svgRound).join(" ")}get defaultProperties(){const[e,t]=this.#mo;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`}}}get rotationTransform(){const[,,e,t]=this.#mo;let n=0,r=0,a=0,o=0,c=0,i=0;switch(this.#Nc){case 90:r=t/e,a=-e/t,c=e;break;case 180:n=-1,o=-1,c=e,i=t;break;case 270:r=-t/e,a=e/t,i=t;break;default:return""}return`matrix(${n} ${r} ${a} ${o} ${bie.svgRound(c)} ${bie.svgRound(i)})`}getPathResizingSVGProperties([e,t,n,r]){const[a,o]=this.#Fc(),[c,i,l,s]=this.#mo;if(Math.abs(l-a)<=bie.PRECISION||Math.abs(s-o)<=bie.PRECISION){const a=e+n/2-(c+l/2),o=t+r/2-(i+s/2);return{path:{"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`,transform:`${this.rotationTransform} translate(${a} ${o})`}}}const h=(n-2*a)/(l-2*a),d=(r-2*o)/(s-2*o),u=l/n,m=s/r;return{path:{"transform-origin":`${bie.svgRound(c)} ${bie.svgRound(i)}`,transform:`${this.rotationTransform} scale(${u} ${m}) translate(${bie.svgRound(a)} ${bie.svgRound(o)}) scale(${h} ${d}) translate(${bie.svgRound(-a)} ${bie.svgRound(-o)})`}}}getPathResizedSVGProperties([e,t,n,r]){const[a,o]=this.#Fc(),c=this.#mo,[i,l,s,h]=c;if(c[0]=e,c[1]=t,c[2]=n,c[3]=r,Math.abs(s-a)<=bie.PRECISION||Math.abs(h-o)<=bie.PRECISION){const a=e+n/2-(i+s/2),o=t+r/2-(l+h/2);for(const{line:e,points:t}of this.#Sc)bie._translate(e,a,o,e),bie._translate(t,a,o,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const d=(n-2*a)/(s-2*a),u=(r-2*o)/(h-2*o),m=-d*(i+a)+e+a,p=-u*(l+o)+t+o;if(1!==d||1!==u||0!==m||0!==p)for(const{line:e,points:t}of this.#Sc)bie._rescale(e,m,p,d,u,e),bie._rescale(t,m,p,d,u,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){const[r,a]=n,o=this.#mo,c=e-o[0],i=t-o[1];if(this.#Oc===r&&this.#Ac===a)for(const{line:e,points:t}of this.#Sc)bie._translate(e,c,i,e),bie._translate(t,c,i,t);else{const e=this.#Oc/r,t=this.#Ac/a;this.#Oc=r,this.#Ac=a;for(const{line:n,points:r}of this.#Sc)bie._rescale(n,c,i,e,t,n),bie._rescale(r,c,i,e,t,r);o[2]*=e,o[3]*=t}return o[0]=e,o[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${bie.svgRound(e)} ${bie.svgRound(t)}`}}}get defaultSVGProperties(){const e=this.#mo;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${bie.svgRound(e[0])} ${bie.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}class Nie extends Tie{#Ic;constructor(e){super(),this.#Ic=e,super.updateProperties({fill:"none",stroke:Yae._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){"stroke-width"===e&&(t??=this["stroke-width"],t*=this.#Ic.realScale),super.updateSVGProperty(e,t)}clone(){const e=new Nie(this.#Ic);return e.updateAll(this),e}}class _ie extends Oie{static _type="ink";static _editorType=Pre.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:"inkEditor"}),this._willKeepAspectRatio=!0}static initialize(e,t){Yae.initialize(e,t),this._defaultDrawingOptions=new Nie(t.viewParameters)}static getDefaultDrawingOptions(e){const t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return Jre(this,"typesMap",new Map([[Fre.INK_THICKNESS,"stroke-width"],[Fre.INK_COLOR,"stroke"],[Fre.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,t,n,r,a){return new Aie(e,t,n,r,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,t,n,r,a,o){return Rie.deserialize(e,t,n,r,a,o)}static async deserialize(e,t,n){let r=null;if(e instanceof uie){const{data:{inkLists:t,rect:n,rotation:a,id:o,color:c,opacity:i,borderStyle:{rawWidth:l},popupRef:s},parent:{page:{pageNumber:h}}}=e;r=e={annotationType:Pre.INK,color:Array.from(c),thickness:l,opacity:i,paths:{points:t},boxes:null,pageIndex:h-1,rect:n.slice(0),rotation:a,id:o,deleted:!1,popupRef:s}}const a=await super.deserialize(e,t,n);return a.annotationElementId=e.id||null,a._initialData=r,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:t,opacity:n}){this._drawingOptions=_ie.getDefaultDrawingOptions({stroke:uae.makeHexColor(...e),"stroke-width":t,"stroke-opacity":n})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:t,points:n,rect:r}=this.serializeDraw(e),{_drawingOptions:{stroke:a,"stroke-opacity":o,"stroke-width":c}}=this,i={annotationType:Pre.INK,color:Yae._colorManager.convert(a),opacity:o,thickness:c,paths:{lines:t,points:n},pageIndex:this.pageIndex,rect:r,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?i:this.annotationElementId&&!this.#Ua(i)?null:(i.id=this.annotationElementId,i)}#Ua(e){const{color:t,thickness:n,opacity:r,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||e.color.some(((e,n)=>e!==t[n]))||e.thickness!==n||e.opacity!==r||e.pageIndex!==a}renderAnnotationElement(e){const{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:t}),null}}class Die extends Yae{#Bc=null;#jc=null;#Uc=null;#Wc=null;#$c=null;#qc="";#Gc=null;#Yc=null;#Kc=!1;#Xc=!1;static _type="stamp";static _editorType=Pre.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#Wc=e.bitmapUrl,this.#$c=e.bitmapFile}static initialize(e,t){Yae.initialize(e,t)}static get supportedTypes(){return Jre(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((e=>`image/${e}`)))}static get supportedTypesStr(){return Jre(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,t){t.pasteEditor(Pre.STAMP,{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){const t=e.get("hasAltText");return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#Qc(e,t=!1){e?(this.#Bc=e.bitmap,t||(this.#jc=e.id,this.#Kc=e.isSvg),e.file&&(this.#qc=e.file.name),this.#Jc()):this.remove()}#Zc(){if(this.#Uc=null,this._uiManager.enableWaiting(!1),this.#Gc){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Bc)return this._editToolbar.hide(),void this._uiManager.editAltText(this,!0);if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#Bc){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:r,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,c=await n.guess({name:"altText",request:{data:r,width:a,height:o,channels:r.length/(a*o)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const i=c.output;return await this.setGuessedAltText(i),t&&!this.hasAltTextData()&&(this.altTextData={alt:i,decorative:!1}),i}#ei(){if(this.#jc)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#jc).then((e=>this.#Qc(e,!0))).finally((()=>this.#Zc()));if(this.#Wc){const e=this.#Wc;return this.#Wc=null,this._uiManager.enableWaiting(!0),void(this.#Uc=this._uiManager.imageManager.getFromUrl(e).then((e=>this.#Qc(e))).finally((()=>this.#Zc())))}if(this.#$c){const e=this.#$c;return this.#$c=null,this._uiManager.enableWaiting(!0),void(this.#Uc=this._uiManager.imageManager.getFromFile(e).then((e=>this.#Qc(e))).finally((()=>this.#Zc())))}const e=document.createElement("input");e.type="file",e.accept=Die.supportedTypesStr;const t=this._uiManager._signal;this.#Uc=new Promise((n=>{e.addEventListener("change",(async()=>{if(e.files&&0!==e.files.length){this._uiManager.enableWaiting(!0);const t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#Qc(t)}else this.remove();n()}),{signal:t}),e.addEventListener("cancel",(()=>{this.remove(),n()}),{signal:t})})).finally((()=>this.#Zc())),e.click()}remove(){this.#jc&&(this.#Bc=null,this._uiManager.imageManager.deleteId(this.#jc),this.#Gc?.remove(),this.#Gc=null,this.#Yc&&(clearTimeout(this.#Yc),this.#Yc=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#jc&&null===this.#Gc&&this.#ei(),this.isAttachedToDOM||this.parent.add(this))):this.#jc&&this.#ei()}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#Uc||this.#Bc||this.#Wc||this.#$c||this.#jc)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this.width&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),this.#Bc?this.#Jc():this.#ei(),this.width&&!this.annotationElementId){const[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r)}return this._uiManager.addShouldRescale(this),this.div}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(null!==this.#Yc&&clearTimeout(this.#Yc),this.#Yc=setTimeout((()=>{this.#Yc=null,this.#ti()}),200))}#Jc(){const{div:e}=this;let{width:t,height:n}=this.#Bc;const[r,a]=this.pageDimensions,o=.75;if(this.width)t=this.width*r,n=this.height*a;else if(t>o*r||n>o*a){const e=Math.min(o*r/t,o*a/n);t*=e,n*=e}const[c,i]=this.parentDimensions;this.setDims(t*c/r,n*i/a),this._uiManager.enableWaiting(!1);const l=this.#Gc=document.createElement("canvas");l.setAttribute("role","img"),this.addContainer(l),this.width=t/r,this.height=n/a,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),this.#ti(),this.#Xc||(this.parent.addUndoableEditor(this),this.#Xc=!0),this._reportTelemetry({action:"inserted_image"}),this.#qc&&l.setAttribute("aria-label",this.#qc)}copyCanvas(e,t,n=!1){e||(e=224);const{width:r,height:a}=this.#Bc,o=new _ae;let c=this.#Bc,i=r,l=a,s=null;if(t){if(r>t||a>t){const e=Math.min(t/r,t/a);i=Math.floor(r*e),l=Math.floor(a*e)}s=document.createElement("canvas");const e=s.width=Math.ceil(i*o.sx),n=s.height=Math.ceil(l*o.sy);this.#Kc||(c=this.#ni(e,n));const h=s.getContext("2d");h.filter=this._uiManager.hcmFilter;let d="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(d="#8f8f9d",u="#42414d");const m=15,p=m*o.sx,v=m*o.sy,f=new OffscreenCanvas(2*p,2*v),z=f.getContext("2d");z.fillStyle=d,z.fillRect(0,0,2*p,2*v),z.fillStyle=u,z.fillRect(0,0,p,v),z.fillRect(p,v,p,v),h.fillStyle=h.createPattern(f,"repeat"),h.fillRect(0,0,e,n),h.drawImage(c,0,0,c.width,c.height,0,0,e,n)}let h=null;if(n){let t,n;if(o.symmetric&&c.width<e&&c.height<e)t=c.width,n=c.height;else if(c=this.#Bc,r>e||a>e){const o=Math.min(e/r,e/a);t=Math.floor(r*o),n=Math.floor(a*o),this.#Kc||(c=this.#ni(t,n))}const i=new OffscreenCanvas(t,n).getContext("2d",{willReadFrequently:!0});i.drawImage(c,0,0,c.width,c.height,0,0,t,n),h={width:t,height:n,data:i.getImageData(0,0,t,n).data}}return{canvas:s,width:i,height:l,imageData:h}}#ni(e,t){const{width:n,height:r}=this.#Bc;let a=n,o=r,c=this.#Bc;for(;a>2*e||o>2*t;){const n=a,r=o;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*t&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const i=new OffscreenCanvas(a,o);i.getContext("2d").drawImage(c,0,0,n,r,0,0,a,o),c=i.transferToImageBitmap()}return c}#ti(){const[e,t]=this.parentDimensions,{width:n,height:r}=this,a=new _ae,o=Math.ceil(n*e*a.sx),c=Math.ceil(r*t*a.sy),i=this.#Gc;if(!i||i.width===o&&i.height===c)return;i.width=o,i.height=c;const l=this.#Kc?this.#Bc:this.#ni(o,c),s=i.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(l,0,0,l.width,l.height,0,0,o,c)}getImageForAltText(){return this.#Gc}#ri(e){if(e){if(this.#Kc){const e=this._uiManager.imageManager.getSvgUrl(this.#jc);if(e)return e}const e=document.createElement("canvas");return({width:e.width,height:e.height}=this.#Bc),e.getContext("2d").drawImage(this.#Bc,0,0),e.toDataURL()}if(this.#Kc){const[e,t]=this.pageDimensions,n=Math.round(this.width*e*gae.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*gae.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(n,r);return a.getContext("2d").drawImage(this.#Bc,0,0,this.#Bc.width,this.#Bc.height,0,0,n,r),a.transferToImageBitmap()}return structuredClone(this.#Bc)}static async deserialize(e,t,n){let r=null;if(e instanceof zie){const{data:{rect:a,rotation:o,id:c,structParent:i,popupRef:l},container:s,parent:{page:{pageNumber:h}}}=e,d=s.querySelector("canvas"),u=n.imageManager.getFromCanvas(s.id,d);d.remove();const m=(await t._structTree.getAriaAttributes(`${fae}${c}`))?.get("aria-label")||"";r=e={annotationType:Pre.STAMP,bitmapId:u.id,bitmap:u.bitmap,pageIndex:h-1,rect:a.slice(0),rotation:o,id:c,deleted:!1,accessibilityData:{decorative:!1,altText:m},isSvg:!1,structParent:i,popupRef:l}}const a=await super.deserialize(e,t,n),{rect:o,bitmap:c,bitmapUrl:i,bitmapId:l,isSvg:s,accessibilityData:h}=e;l&&n.imageManager.isValidId(l)?(a.#jc=l,c&&(a.#Bc=c)):a.#Wc=i,a.#Kc=s;const[d,u]=a.pageDimensions;return a.width=(o[2]-o[0])/d,a.height=(o[3]-o[1])/u,a.annotationElementId=e.id||null,h&&(a.altTextData=h),a._initialData=r,a.#Xc=!!r,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n={annotationType:Pre.STAMP,bitmapId:this.#jc,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#Kc,structTreeParentId:this._structTreeParentId};if(e)return n.bitmapUrl=this.#ri(!0),n.accessibilityData=this.serializeAltText(!0),n;const{decorative:r,altText:a}=this.serializeAltText(!1);if(!r&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const e=this.#Ua(n);if(e.isSame)return null;e.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1}if(n.id=this.annotationElementId,null===t)return n;t.stamps||=new Map;const o=this.#Kc?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(t.stamps.has(this.#jc)){if(this.#Kc){const e=t.stamps.get(this.#jc);o>e.area&&(e.area=o,e.serialized.bitmap.close(),e.serialized.bitmap=this.#ri(!1))}}else t.stamps.set(this.#jc,{area:o,serialized:n}),n.bitmap=this.#ri(!1);return n}#Ua(e){const{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===t,a=(e.accessibilityData?.alt||"")===n;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&r&&a,isSameAltText:a}}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}}class Pie{#La;#ai=!1;#oi=null;#ci=null;#ii=null;#li=new Map;#si=!1;#hi=!1;#di=!1;#ui=null;#mi=null;#pi=null;#vi=null;#v;static _initialized=!1;static#B=new Map([Eie,_ie,Die,xie].map((e=>[e._editorType,e])));constructor({uiManager:e,pageIndex:t,div:n,structTreeLayer:r,accessibilityManager:a,annotationLayer:o,drawLayer:c,textLayer:i,viewport:l,l10n:s}){const h=[...Pie.#B.values()];if(!Pie._initialized){Pie._initialized=!0;for(const t of h)t.initialize(s,e)}e.registerEditorTypes(h),this.#v=e,this.pageIndex=t,this.div=n,this.#La=a,this.#oi=o,this.viewport=l,this.#pi=i,this.drawLayer=c,this._structTree=r,this.#v.addLayer(this)}get isEmpty(){return 0===this.#li.size}get isInvisible(){return this.isEmpty&&this.#v.getMode()===Pre.NONE}updateToolbar(e){this.#v.updateToolbar(e)}updateMode(e=this.#v.getMode()){switch(this.#fi(),e){case Pre.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case Pre.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Pre.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const n of Pie.#B.values())t.toggle(`${n._type}Editing`,e===n._editorType);this.div.hidden=!1}hasTextLayer(e){return e===this.#pi?.div}setEditingState(e){this.#v.setEditingState(e)}addCommands(e){this.#v.addCommands(e)}cleanUndoStack(e){this.#v.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#oi?.div.classList.toggle("disabled",!e)}async enable(){this.#di=!0,this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const t of this.#li.values())t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#v.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));if(!this.#oi)return void(this.#di=!1);const t=this.#oi.getEditableAnnotations();for(const n of t){if(n.hide(),this.#v.isDeletedAnnotationElement(n.data.id))continue;if(e.has(n.data.id))continue;const t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}this.#di=!1}disable(){this.#hi=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const n of this.#li.values())n.disableEditing(),n.annotationElementId&&(null===n.serialize()?(t.set(n.annotationElementId,n),this.getEditableAnnotation(n.annotationElementId)?.show(),n.remove()):e.set(n.annotationElementId,n));if(this.#oi){const n=this.#oi.getEditableAnnotations();for(const r of n){const{id:n}=r.data;if(this.#v.isDeletedAnnotationElement(n))continue;let a=t.get(n);a?(a.resetAnnotationElement(r),a.show(!1),r.show()):(a=e.get(n),a&&(this.#v.addChangedExistingAnnotation(a),a.renderAnnotationElement(r)&&a.show(!1)),r.show())}}this.#fi(),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const e of Pie.#B.values())n.remove(`${e._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#hi=!1}getEditableAnnotation(e){return this.#oi?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#v.getActive()!==e&&this.#v.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#pi?.div&&!this.#vi){this.#vi=new AbortController;const e=this.#v.combinedSignal(this.#vi);this.#pi.div.addEventListener("pointerdown",this.#zi.bind(this),{signal:e}),this.#pi.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#pi?.div&&this.#vi&&(this.#vi.abort(),this.#vi=null,this.#pi.div.classList.remove("highlighting"))}#zi(e){this.#v.unselectAll();const{target:t}=e;if(t===this.#pi.div||("img"===t.getAttribute("role")||t.classList.contains("endOfContent"))&&this.#pi.div.contains(t)){const{isMac:t}=hae.platform;if(0!==e.button||e.ctrlKey&&t)return;this.#v.showAllEditors("highlight",!0,!0),this.#pi.div.classList.add("free"),this.toggleDrawing(),xie.startHighlighting(this,"ltr"===this.#v.direction,{target:this.#pi.div,x:e.x,y:e.y}),this.#pi.div.addEventListener("pointerup",(()=>{this.#pi.div.classList.remove("free"),this.toggleDrawing(!0)}),{once:!0,signal:this.#v._signal}),e.preventDefault()}}enableClick(){if(this.#ci)return;this.#ci=new AbortController;const e=this.#v.combinedSignal(this.#ci);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){this.#ci?.abort(),this.#ci=null}attach(e){this.#li.set(e.id,e);const{annotationElementId:t}=e;t&&this.#v.isDeletedAnnotationElement(t)&&this.#v.removeDeletedAnnotationElement(e)}detach(e){this.#li.delete(e.id),this.#La?.removePointerInTextLayer(e.contentDiv),!this.#hi&&e.annotationElementId&&this.#v.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#v.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#v.addDeletedAnnotationElement(e.annotationElementId),Yae.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(e.parent!==this||!e.isAttachedToDOM){if(this.changeParent(e),this.#v.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#di),this.#v.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!this.#ii&&(e._focusEventsAllowed=!1,this.#ii=setTimeout((()=>{this.#ii=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0,signal:this.#v._signal}),t.focus())}),0)),e._structTreeParentId=this.#La?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#v.getId()}get#gi(){return Pie.#B.get(this.#v.getMode())}combinedSignal(e){return this.#v.combinedSignal(e)}#yi(e){const t=this.#gi;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#gi?.canCreateNewEmptyEditor()}pasteEditor(e,t){this.#v.updateToolbar(e),this.#v.updateMode(e);const{offsetX:n,offsetY:r}=this.#Mi(),a=this.getNextId(),o=this.#yi({parent:this,id:a,x:n,y:r,uiManager:this.#v,isCentered:!0,...t});o&&this.add(o)}async deserialize(e){return await(Pie.#B.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#v))||null}createAndAddNewEditor(e,t,n={}){const r=this.getNextId(),a=this.#yi({parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:this.#v,isCentered:t,...n});return a&&this.add(a),a}#Mi(){const{x:e,y:t,width:n,height:r}=this.div.getBoundingClientRect(),a=Math.max(0,e),o=Math.max(0,t),c=(a+Math.min(window.innerWidth,e+n))/2-e,i=(o+Math.min(window.innerHeight,t+r))/2-t,[l,s]=this.viewport.rotation%180==0?[c,i]:[i,c];return{offsetX:l,offsetY:s}}addNewEditor(){this.createAndAddNewEditor(this.#Mi(),!0)}setSelected(e){this.#v.setSelected(e)}toggleSelected(e){this.#v.toggleSelected(e)}unselect(e){this.#v.unselect(e)}pointerup(e){const{isMac:t}=hae.platform;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#si&&(this.#si=!1,this.#gi?.isDrawer&&this.#gi.supportMultipleDrawings||(this.#ai?this.#v.getMode()!==Pre.STAMP?this.createAndAddNewEditor(e,!1):this.#v.unselectAll():this.#ai=!0))}pointerdown(e){if(this.#v.getMode()===Pre.HIGHLIGHT&&this.enableTextSelection(),this.#si)return void(this.#si=!1);const{isMac:t}=hae.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;if(this.#si=!0,this.#gi?.isDrawer)return void this.startDrawingSession(e);const n=this.#v.getActive();this.#ai=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus(),this.#ui)return void this.#gi.startDrawing(this,this.#v,!1,e);this.#v.setCurrentDrawingSession(this),this.#ui=new AbortController;const t=this.#v.combinedSignal(this.#ui);this.div.addEventListener("blur",(({relatedTarget:e})=>{e&&!this.div.contains(e)&&(this.#mi=null,this.commitOrRemove())}),{signal:t}),this.#gi.startDrawing(this,this.#v,!1,e)}pause(e){if(e){const{activeElement:e}=document;this.div.contains(e)&&(this.#mi=e)}else this.#mi&&setTimeout((()=>{this.#mi?.focus(),this.#mi=null}),0)}endDrawingSession(e=!1){return this.#ui?(this.#v.setCurrentDrawingSession(null),this.#ui.abort(),this.#ui=null,this.#mi=null,this.#gi.endDrawing(e)):null}findNewParent(e,t,n){const r=this.#v.findParent(t,n);return null!==r&&r!==this&&(r.changeParent(e),!0)}commitOrRemove(){return!!this.#ui&&(this.endDrawingSession(),!0)}onScaleChanging(){this.#ui&&this.#gi.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#v.getActive()?.parent===this&&(this.#v.commitOrRemove(),this.#v.setActiveEditor(null)),this.#ii&&(clearTimeout(this.#ii),this.#ii=null);for(const e of this.#li.values())this.#La?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#li.clear(),this.#v.removeLayer(this)}#fi(){for(const e of this.#li.values())e.isEmpty()&&e.remove()}render({viewport:e}){this.viewport=e,Nae(this.div,e);for(const e of this.#v.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:e}){this.#v.commitOrRemove(),this.#fi();const t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,Nae(this.div,{rotation:n}),t!==n)for(const e of this.#li.values())e.rotate(n)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#v.viewParameters.realScale}}class Fie{#aa=null;#y=0;#Ei=new Map;#bi=new Map;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(this.#aa){if(this.#aa!==e){if(this.#Ei.size>0)for(const t of this.#Ei.values())t.remove(),e.append(t);this.#aa=e}}else this.#aa=e}static get _svgFactory(){return Jre(this,"_svgFactory",new Bce)}static#Hi(e,[t,n,r,a]){const{style:o}=e;o.top=100*n+"%",o.left=100*t+"%",o.width=100*r+"%",o.height=100*a+"%"}#Vi(){const e=Fie._svgFactory.create(1,1,!0);return this.#aa.append(e),e.setAttribute("aria-hidden",!0),e}#Ci(e,t){const n=Fie._svgFactory.createElement("clipPath");e.append(n);const r=`clip_${t}`;n.setAttribute("id",r),n.setAttribute("clipPathUnits","objectBoundingBox");const a=Fie._svgFactory.createElement("use");return n.append(a),a.setAttribute("href",`#${t}`),a.classList.add("clip"),r}#Li(e,t){for(const[n,r]of Object.entries(t))null===r?e.removeAttribute(n):e.setAttribute(n,r)}draw(e,t=!1,n=!1){const r=this.#y++,a=this.#Vi(),o=Fie._svgFactory.createElement("defs");a.append(o);const c=Fie._svgFactory.createElement("path");o.append(c);const i=`path_p${this.pageIndex}_${r}`;c.setAttribute("id",i),c.setAttribute("vector-effect","non-scaling-stroke"),t&&this.#bi.set(r,c);const l=n?this.#Ci(o,i):null,s=Fie._svgFactory.createElement("use");return a.append(s),s.setAttribute("href",`#${i}`),this.updateProperties(a,e),this.#Ei.set(r,a),{id:r,clipPathId:`url(#${l})`}}drawOutline(e,t){const n=this.#y++,r=this.#Vi(),a=Fie._svgFactory.createElement("defs");r.append(a);const o=Fie._svgFactory.createElement("path");a.append(o);const c=`path_p${this.pageIndex}_${n}`;let i;if(o.setAttribute("id",c),o.setAttribute("vector-effect","non-scaling-stroke"),t){const e=Fie._svgFactory.createElement("mask");a.append(e),i=`mask_p${this.pageIndex}_${n}`,e.setAttribute("id",i),e.setAttribute("maskUnits","objectBoundingBox");const t=Fie._svgFactory.createElement("rect");e.append(t),t.setAttribute("width","1"),t.setAttribute("height","1"),t.setAttribute("fill","white");const r=Fie._svgFactory.createElement("use");e.append(r),r.setAttribute("href",`#${c}`),r.setAttribute("stroke","none"),r.setAttribute("fill","black"),r.setAttribute("fill-rule","nonzero"),r.classList.add("mask")}const l=Fie._svgFactory.createElement("use");r.append(l),l.setAttribute("href",`#${c}`),i&&l.setAttribute("mask",`url(#${i})`);const s=l.cloneNode();return r.append(s),l.classList.add("mainOutline"),s.classList.add("secondaryOutline"),this.updateProperties(r,e),this.#Ei.set(n,r),n}finalizeDraw(e,t){this.#bi.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;const{root:n,bbox:r,rootClass:a,path:o}=t,c="number"==typeof e?this.#Ei.get(e):e;if(c){if(n&&this.#Li(c,n),r&&Fie.#Hi(c,r),a){const{classList:e}=c;for(const[t,n]of Object.entries(a))e.toggle(t,n)}if(o){const e=c.firstChild.firstChild;this.#Li(e,o)}}}updateParent(e,t){if(t===this)return;const n=this.#Ei.get(e);n&&(t.#aa.append(n),this.#Ei.delete(e),t.#Ei.set(e,n))}remove(e){this.#bi.delete(e),null!==this.#aa&&(this.#Ei.get(e).remove(),this.#Ei.delete(e))}destroy(){this.#aa=null;for(const e of this.#Ei.values())e.remove();this.#Ei.clear(),this.#bi.clear()}}globalThis.pdfjsTestingUtils={HighlightOutliner:Cie};var Iie=Ore.GlobalWorkerOptions,Bie=Ore.TextLayer,jie=Ore.getDocument;function Uie(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===n&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}Uie('.messageBar{--closing-button-icon:url(images/messageBar_closingButton.svg);--message-bar-close-button-color:var(--text-primary-color);--message-bar-close-button-color-hover:var(--text-primary-color);--message-bar-close-button-border-radius:4px;--message-bar-close-button-border:none;--message-bar-close-button-hover-bg-color:#15141a24;--message-bar-close-button-active-bg-color:#15141a36;--message-bar-close-button-focus-bg-color:#15141a12}@media (prefers-color-scheme:dark){.messageBar{--message-bar-close-button-hover-bg-color:#fbfbfe24;--message-bar-close-button-active-bg-color:#fbfbfe36;--message-bar-close-button-focus-bg-color:#fbfbfe12}}@media screen and (forced-colors:active){.messageBar{--message-bar-close-button-color:ButtonText;--message-bar-close-button-border:1px solid ButtonText;--message-bar-close-button-hover-bg-color:ButtonText;--message-bar-close-button-active-bg-color:ButtonText;--message-bar-close-button-focus-bg-color:ButtonText;--message-bar-close-button-color-hover:HighlightText}}.messageBar{align-items:center;background:var(--message-bar-bg-color);border:1px solid var(--message-bar-border-color);border-radius:4px;color:var(--message-bar-fg-color);display:flex;flex-direction:column;gap:8px;justify-content:center;padding:8px 8px 8px 16px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.messageBar>div{align-items:flex-start;align-self:stretch;display:flex;gap:8px}:is(.messageBar>div):before{background-color:var(--message-bar-icon-color);content:"";display:inline-block;flex-shrink:0;height:16px;-webkit-mask-image:var(--message-bar-icon);mask-image:var(--message-bar-icon);-webkit-mask-size:cover;mask-size:cover;width:16px}.messageBar button{cursor:pointer}:is(.messageBar button):focus-visible{outline:var(--focus-ring-outline);outline-offset:2px}.messageBar .closeButton{align-items:center;background:none;border:var(--message-bar-close-button-border);border-radius:var(--message-bar-close-button-border-radius);display:flex;height:32px;justify-content:center;width:32px}:is(.messageBar .closeButton):before{background-color:var(--message-bar-close-button-color);content:"";display:inline-block;height:16px;-webkit-mask-image:var(--closing-button-icon);mask-image:var(--closing-button-icon);-webkit-mask-size:cover;mask-size:cover;width:16px}:is(.messageBar .closeButton):is(:hover,:active,:focus):before{background-color:var(--message-bar-close-button-color-hover)}:is(.messageBar .closeButton):hover{background-color:var(--message-bar-close-button-hover-bg-color)}:is(.messageBar .closeButton):active{background-color:var(--message-bar-close-button-active-bg-color)}:is(.messageBar .closeButton):focus{background-color:var(--message-bar-close-button-focus-bg-color)}:is(.messageBar .closeButton)>span{display:inline-block;height:0;overflow:hidden;width:0}#editorUndoBar{--text-primary-color:#15141a;--message-bar-icon:url(images/secondaryToolbarButton-documentProperties.svg);--message-bar-icon-color:#0060df;--message-bar-bg-color:#deeafc;--message-bar-fg-color:var(--text-primary-color);--message-bar-border-color:#00000014;--undo-button-bg-color:#15141a12;--undo-button-bg-color-hover:#15141a24;--undo-button-bg-color-active:#15141a36;--undo-button-fg-color:var(--message-bar-fg-color);--undo-button-fg-color-hover:var(--undo-button-fg-color);--undo-button-fg-color-active:var(--undo-button-fg-color);--focus-ring-color:#0060df;--focus-ring-outline:2px solid var(--focus-ring-color)}@media (prefers-color-scheme:dark){#editorUndoBar{--text-primary-color:#fbfbfe;--message-bar-icon-color:#73a7f3;--message-bar-bg-color:#003070;--message-bar-border-color:#ffffff14;--undo-button-bg-color:#ffffff14;--undo-button-bg-color-hover:#ffffff24;--undo-button-bg-color-active:#ffffff36}}@media screen and (forced-colors:active){#editorUndoBar{--text-primary-color:CanvasText;--message-bar-icon-color:CanvasText;--message-bar-bg-color:Canvas;--message-bar-border-color:CanvasText;--undo-button-bg-color:ButtonText;--undo-button-bg-color-hover:SelectedItem;--undo-button-bg-color-active:SelectedItem;--undo-button-fg-color:ButtonFace;--undo-button-fg-color-hover:SelectedItemText;--undo-button-fg-color-active:SelectedItemText;--focus-ring-color:CanvasText}}#editorUndoBar{cursor:default;font:menu;font-size:15px;left:50%;padding-block:8px;padding-inline:16px 8px;position:fixed;top:50px;transform:translateX(-50%);z-index:10}#editorUndoBar button{cursor:pointer}#editorUndoBar #editorUndoBarUndoButton{background-color:var(--undo-button-bg-color);border:none;border-radius:4px;color:var(--undo-button-fg-color);font-weight:590;height:32px;line-height:19.5px;margin-inline-start:8px;padding:4px 16px}:is(#editorUndoBar #editorUndoBarUndoButton):hover{background-color:var(--undo-button-bg-color-hover);color:var(--undo-button-fg-color-hover)}:is(#editorUndoBar #editorUndoBarUndoButton):active{background-color:var(--undo-button-bg-color-active);color:var(--undo-button-fg-color-active)}#editorUndoBar>div{align-items:center}.dialog{--dialog-bg-color:#fff;--dialog-border-color:#fff;--dialog-shadow:0 2px 14px 0 #3a394433;--text-primary-color:#15141a;--text-secondary-color:#5b5b66;--hover-filter:brightness(0.9);--focus-ring-color:#0060df;--focus-ring-outline:2px solid var(--focus-ring-color);--link-fg-color:#0060df;--link-hover-fg-color:#0250bb;--separator-color:#f0f0f4;--textarea-border-color:#8f8f9d;--textarea-bg-color:#fff;--textarea-fg-color:var(--text-secondary-color);--radio-bg-color:#f0f0f4;--radio-checked-bg-color:#fbfbfe;--radio-border-color:#8f8f9d;--radio-checked-border-color:#0060df;--button-secondary-bg-color:#f0f0f4;--button-secondary-fg-color:var(--text-primary-color);--button-secondary-border-color:var(--button-secondary-bg-color);--button-secondary-hover-bg-color:var(--button-secondary-bg-color);--button-secondary-hover-fg-color:var(--button-secondary-fg-color);--button-secondary-hover-border-color:var(--button-secondary-hover-bg-color);--button-primary-bg-color:#0060df;--button-primary-fg-color:#fbfbfe;--button-primary-border-color:var(--button-primary-bg-color);--button-primary-hover-bg-color:var(--button-primary-bg-color);--button-primary-hover-fg-color:var(--button-primary-fg-color);--button-primary-hover-border-color:var(--button-primary-hover-bg-color)}@media (prefers-color-scheme:dark){.dialog{--dialog-bg-color:#1c1b22;--dialog-border-color:#1c1b22;--dialog-shadow:0 2px 14px 0 #15141a;--text-primary-color:#fbfbfe;--text-secondary-color:#cfcfd8;--focus-ring-color:#0df;--hover-filter:brightness(1.4);--link-fg-color:#0df;--link-hover-fg-color:#80ebff;--separator-color:#52525e;--textarea-bg-color:#42414d;--radio-bg-color:#2b2a33;--radio-checked-bg-color:#15141a;--radio-checked-border-color:#0df;--button-secondary-bg-color:#2b2a33;--button-primary-bg-color:#0df;--button-primary-fg-color:#15141a}}@media screen and (forced-colors:active){.dialog{--dialog-bg-color:Canvas;--dialog-border-color:CanvasText;--dialog-shadow:none;--text-primary-color:CanvasText;--text-secondary-color:CanvasText;--hover-filter:none;--focus-ring-color:ButtonBorder;--link-fg-color:LinkText;--link-hover-fg-color:LinkText;--separator-color:CanvasText;--textarea-border-color:ButtonBorder;--textarea-bg-color:Field;--textarea-fg-color:ButtonText;--radio-bg-color:ButtonFace;--radio-checked-bg-color:ButtonFace;--radio-border-color:ButtonText;--radio-checked-border-color:ButtonText;--button-secondary-bg-color:ButtonFace;--button-secondary-fg-color:ButtonText;--button-secondary-border-color:ButtonText;--button-secondary-hover-bg-color:AccentColor;--button-secondary-hover-fg-color:AccentColorText;--button-primary-bg-color:ButtonText;--button-primary-fg-color:ButtonFace;--button-primary-hover-bg-color:AccentColor;--button-primary-hover-fg-color:AccentColorText}}.dialog{background:var(--dialog-bg-color);border:1px solid var(--dialog-border-color);border-radius:4px;box-shadow:var(--dialog-shadow);color:var(--text-primary-color);font:message-box;font-size:13px;font-weight:400;line-height:150%;padding:12px 16px}:is(.dialog .mainContainer) :focus-visible{outline:var(--focus-ring-outline);outline-offset:2px}:is(.dialog .mainContainer) .title{align-items:flex-start;display:flex;flex-direction:column;gap:12px;justify-content:flex-end;width:auto}:is(:is(.dialog .mainContainer) .title)>span{font-size:13px;font-style:normal;font-weight:590;line-height:150%}:is(.dialog .mainContainer) .dialogSeparator{border-bottom:none;border-top:1px solid var(--separator-color);height:0;margin-block:4px;width:100%}:is(.dialog .mainContainer) .dialogButtonsGroup{align-self:flex-end;display:flex;gap:12px}:is(.dialog .mainContainer) .radio{align-items:flex-start;display:flex;flex-direction:column;gap:4px}:is(:is(.dialog .mainContainer) .radio)>.radioButton{align-items:center;align-self:stretch;display:flex;gap:8px}:is(:is(:is(.dialog .mainContainer) .radio)>.radioButton) input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--radio-bg-color);border:1px solid var(--radio-border-color);border-radius:50%;box-sizing:border-box;height:16px;width:16px}:is(:is(:is(:is(.dialog .mainContainer) .radio)>.radioButton) input):hover{filter:var(--hover-filter)}:is(:is(:is(:is(.dialog .mainContainer) .radio)>.radioButton) input):checked{background-color:var(--radio-checked-bg-color);border:4px solid var(--radio-checked-border-color)}:is(:is(.dialog .mainContainer) .radio)>.radioLabel{align-items:flex-start;align-self:stretch;display:flex;gap:10px;padding-inline-start:24px}:is(:is(:is(.dialog .mainContainer) .radio)>.radioLabel)>span{color:var(--text-secondary-color);flex:1 0 0;font-size:11px}:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton)){border:1px solid;border-radius:4px;font:menu;font-weight:600;height:32px;padding:4px 16px;width:auto}:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{cursor:pointer;filter:var(--hover-filter)}.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))){background-color:var(--button-secondary-bg-color);border-color:var(--button-secondary-border-color);color:var(--button-secondary-fg-color)}.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{background-color:var(--button-secondary-hover-bg-color);border-color:var(--button-secondary-hover-border-color);color:var(--button-secondary-hover-fg-color)}.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))){background-color:var(--button-primary-bg-color);border-color:var(--button-primary-border-color);color:var(--button-primary-fg-color);opacity:1}.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton))):hover{background-color:var(--button-primary-hover-bg-color);border-color:var(--button-primary-hover-border-color);color:var(--button-primary-hover-fg-color)}:is(.dialog .mainContainer) a{color:var(--link-fg-color)}:is(:is(.dialog .mainContainer) a):hover{color:var(--link-hover-fg-color)}:is(.dialog .mainContainer) textarea{background:var(--textarea-bg-color);border:1px solid var(--textarea-border-color);border-radius:4px;box-sizing:border-box;color:var(--textarea-fg-color);font:inherit;margin:0;padding:8px;resize:none}:is(:is(.dialog .mainContainer) textarea):focus{border-color:#0000;outline-offset:0}:is(:is(.dialog .mainContainer) textarea):disabled{opacity:.4;pointer-events:none}:is(.dialog .mainContainer) .messageBar{--message-bar-bg-color:#ffebcd;--message-bar-fg-color:#15141a;--message-bar-border-color:#00000014;--message-bar-icon:url(images/messageBar_warning.svg);--message-bar-icon-color:#cd411e}@media (prefers-color-scheme:dark){:is(.dialog .mainContainer) .messageBar{--message-bar-bg-color:#5a3100;--message-bar-fg-color:#fbfbfe;--message-bar-border-color:#ffffff14;--message-bar-icon-color:#e49c49}}@media screen and (forced-colors:active){:is(.dialog .mainContainer) .messageBar{--message-bar-bg-color:HighlightText;--message-bar-fg-color:CanvasText;--message-bar-border-color:CanvasText;--message-bar-icon-color:CanvasText}}:is(.dialog .mainContainer) .messageBar{align-self:stretch}:is(:is(:is(.dialog .mainContainer) .messageBar)>div):before,:is(:is(:is(.dialog .mainContainer) .messageBar)>div)>div{margin-block:4px}:is(:is(:is(.dialog .mainContainer) .messageBar)>div)>div{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;gap:8px}:is(:is(:is(:is(.dialog .mainContainer) .messageBar)>div)>div) .title{font-size:13px;font-weight:590}:is(:is(:is(:is(.dialog .mainContainer) .messageBar)>div)>div) .description{font-size:13px}:is(.dialog .mainContainer) .toggler{align-items:center;align-self:stretch;display:flex;gap:8px}:is(:is(.dialog .mainContainer) .toggler)>.togglerLabel{-webkit-user-select:none;-moz-user-select:none;user-select:none}.textLayer{-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;caret-color:CanvasText;forced-color-adjust:none;inset:0;line-height:1;opacity:1;overflow:clip;position:absolute;text-align:initial;transform-origin:0 0;z-index:0}.textLayer.highlighting{touch-action:none}.textLayer :is(span,br){color:#0000;cursor:text;position:absolute;transform-origin:0 0;white-space:pre}.textLayer .markedContent span:not(.markedContent),.textLayer>:not(.markedContent){z-index:1}.textLayer span.markedContent{height:0;top:0}.textLayer span[role=img]{cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textLayer .highlight{--highlight-bg-color:#b400aa40;--highlight-selected-bg-color:#00640040;--highlight-backdrop-filter:none;--highlight-selected-backdrop-filter:none}@media screen and (forced-colors:active){.textLayer .highlight{--highlight-bg-color:#0000;--highlight-selected-bg-color:#0000;--highlight-backdrop-filter:var(--hcm-highlight-filter);--highlight-selected-backdrop-filter:var(\n --hcm-highlight-selected-filter\n )}}.textLayer .highlight{-webkit-backdrop-filter:var(--highlight-backdrop-filter);backdrop-filter:var(--highlight-backdrop-filter);background-color:var(--highlight-bg-color);border-radius:4px;margin:-1px;padding:1px}.appended:is(.textLayer .highlight){position:static}.begin:is(.textLayer .highlight){border-radius:4px 0 0 4px}.end:is(.textLayer .highlight){border-radius:0 4px 4px 0}.middle:is(.textLayer .highlight){border-radius:0}.selected:is(.textLayer .highlight){-webkit-backdrop-filter:var(--highlight-selected-backdrop-filter);backdrop-filter:var(--highlight-selected-backdrop-filter);background-color:var(--highlight-selected-bg-color)}.textLayer ::-moz-selection{background:#0000ff40;background:color-mix(in srgb,AccentColor,#0000 75%)}.textLayer ::selection{background:#0000ff40;background:color-mix(in srgb,AccentColor,#0000 75%)}.textLayer br::-moz-selection{background:#0000}.textLayer br::selection{background:#0000}.textLayer .endOfContent{cursor:default;display:block;inset:100% 0 0;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:0}.textLayer.selecting .endOfContent{top:0}.annotationLayer{--annotation-unfocused-field-background:url(\'data:image/svg+xml;charset=utf-8,<svg width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" style="fill:rgba(0,54,255,.13)"/></svg>\');--input-focus-border-color:Highlight;--input-focus-outline:1px solid Canvas;--input-unfocused-border-color:#0000;--input-disabled-border-color:#0000;--input-hover-border-color:#000;--link-outline:none}@media screen and (forced-colors:active){.annotationLayer{--input-focus-border-color:CanvasText;--input-unfocused-border-color:ActiveText;--input-disabled-border-color:GrayText;--input-hover-border-color:Highlight;--link-outline:1.5px solid LinkText}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .textWidgetAnnotation :is(input,textarea):required{outline:1.5px solid selectedItem}.annotationLayer .linkAnnotation{outline:var(--link-outline)}:is(.annotationLayer .linkAnnotation):hover{-webkit-backdrop-filter:var(--hcm-highlight-filter);backdrop-filter:var(--hcm-highlight-filter)}:is(.annotationLayer .linkAnnotation)>a:hover{background:none!important;box-shadow:none;opacity:0!important}.annotationLayer .popupAnnotation .popup{background-color:ButtonFace!important;color:ButtonText!important;outline:calc(1.5px*var(--scale-factor)) solid CanvasText!important}.annotationLayer .highlightArea:hover:after{-webkit-backdrop-filter:var(--hcm-highlight-filter);backdrop-filter:var(--hcm-highlight-filter);content:"";height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.annotationLayer .popupAnnotation.focused .popup{outline:calc(3px*var(--scale-factor)) solid Highlight!important}}.annotationLayer{left:0;pointer-events:none;position:absolute;top:0;transform-origin:0 0}.annotationLayer[data-main-rotation="90"] .norotate{transform:rotate(270deg) translateX(-100%)}.annotationLayer[data-main-rotation="180"] .norotate{transform:rotate(180deg) translate(-100%,-100%)}.annotationLayer[data-main-rotation="270"] .norotate{transform:rotate(90deg) translateY(-100%)}.annotationLayer.disabled .popup,.annotationLayer.disabled section{pointer-events:none}.annotationLayer .annotationContent{height:100%;pointer-events:none;position:absolute;width:100%}.freetext:is(.annotationLayer .annotationContent){background:#0000;border:none;font:10px sans-serif;inset:0;line-height:1.35;overflow:visible;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.annotationLayer section{box-sizing:border-box;pointer-events:auto;position:absolute;text-align:initial;transform-origin:0 0}:is(.annotationLayer section):has(div.annotationContent) canvas.annotationContent{display:none}.textLayer.selecting~.annotationLayer section{pointer-events:none}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton)>a{font-size:1em;height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton):not(.hasBorder)>a:hover{background-color:#ff0;box-shadow:0 2px 10px #ff0;opacity:.2}.annotationLayer .linkAnnotation.hasBorder:hover{background-color:#ff03}.annotationLayer .hasBorder{background-size:100% 100%}.annotationLayer .textAnnotation img{cursor:pointer;height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input,.annotationLayer .choiceWidgetAnnotation select,.annotationLayer .textWidgetAnnotation :is(input,textarea){background-image:var(--annotation-unfocused-field-background);border:2px solid var(--input-unfocused-border-color);box-sizing:border-box;font:calc(9px*var(--scale-factor)) sans-serif;height:100%;margin:0;vertical-align:top;width:100%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .textWidgetAnnotation :is(input,textarea):required{outline:1.5px solid red}.annotationLayer .choiceWidgetAnnotation select option{padding:0}.annotationLayer .buttonWidgetAnnotation.radioButton input{border-radius:50%}.annotationLayer .textWidgetAnnotation textarea{resize:none}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input[disabled],.annotationLayer .choiceWidgetAnnotation select[disabled],.annotationLayer .textWidgetAnnotation [disabled]:is(input,textarea){background:none;border:2px solid var(--input-disabled-border-color);cursor:not-allowed}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .textWidgetAnnotation :is(input,textarea):hover{border:2px solid var(--input-hover-border-color)}.annotationLayer .buttonWidgetAnnotation.checkBox input:hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .textWidgetAnnotation :is(input,textarea):hover{border-radius:2px}.annotationLayer .choiceWidgetAnnotation select:focus,.annotationLayer .textWidgetAnnotation :is(input,textarea):focus{background:none;border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) :focus{background-color:initial;background-image:none}.annotationLayer .buttonWidgetAnnotation.checkBox :focus{border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.radioButton :focus{border:2px solid var(--input-focus-border-color);outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{background-color:CanvasText;content:"";display:block;position:absolute}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{height:80%;left:45%;width:1px}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{transform:rotate(45deg)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{transform:rotate(-45deg)}.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{border-radius:50%;height:50%;left:25%;top:25%;width:50%}.annotationLayer .textWidgetAnnotation input.comb{font-family:monospace;padding-left:2px;padding-right:0}.annotationLayer .textWidgetAnnotation input.comb:focus{width:103%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{-webkit-appearance:none;-moz-appearance:none;appearance:none}.annotationLayer .fileAttachmentAnnotation .popupTriggerArea{height:100%;width:100%}.annotationLayer .popupAnnotation{font-size:calc(9px*var(--scale-factor));height:auto;max-width:45%;pointer-events:none;position:absolute;width:-moz-max-content;width:max-content}.annotationLayer .popup{word-wrap:break-word;background-color:#ff9;border-radius:calc(2px*var(--scale-factor));box-shadow:0 calc(2px*var(--scale-factor)) calc(5px*var(--scale-factor)) #888;cursor:pointer;font:message-box;outline:1.5px solid #ffff4a;padding:calc(6px*var(--scale-factor));pointer-events:auto;white-space:normal}.annotationLayer .popupAnnotation.focused .popup{outline-width:3px}.annotationLayer .popup *{font-size:calc(9px*var(--scale-factor))}.annotationLayer .popup>.header{display:inline-block}.annotationLayer .popup>.header h1{display:inline}.annotationLayer .popup>.header .popupDate{display:inline-block;margin-left:calc(5px*var(--scale-factor));width:-moz-fit-content;width:fit-content}.annotationLayer .popupContent{border-top:1px solid #333;margin-top:calc(2px*var(--scale-factor));padding-top:calc(2px*var(--scale-factor))}.annotationLayer .richText>*{font-size:calc(9px*var(--scale-factor));white-space:pre-wrap}.annotationLayer .popupTriggerArea{cursor:pointer}.annotationLayer section svg{height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer .annotationTextContent{color:#0000;height:100%;opacity:0;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}:is(.annotationLayer .annotationTextContent) span{display:inline-block;width:100%}.annotationLayer svg.quadrilateralsContainer{contain:strict;height:0;left:0;position:absolute;top:0;width:0;z-index:-1}:root{--xfa-unfocused-field-background:url(\'data:image/svg+xml;charset=utf-8,<svg width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" style="fill:rgba(0,54,255,.13)"/></svg>\');--xfa-focus-outline:auto}@media screen and (forced-colors:active){:root{--xfa-focus-outline:2px solid CanvasText}.xfaLayer :required{outline:1.5px solid selectedItem}}.xfaLayer{background-color:initial}.xfaLayer .highlight{background-color:#efcbed;border-radius:4px;margin:-1px;padding:1px}.xfaLayer .highlight.appended{position:static}.xfaLayer .highlight.begin{border-radius:4px 0 0 4px}.xfaLayer .highlight.end{border-radius:0 4px 4px 0}.xfaLayer .highlight.middle{border-radius:0}.xfaLayer .highlight.selected{background-color:#cbdfcb}.xfaPage{overflow:hidden;position:relative}.xfaContentarea{position:absolute}.xfaPrintOnly{display:none}.xfaLayer{left:0;line-height:1.2;position:absolute;text-align:initial;top:0;transform-origin:0 0}.xfaLayer *{background-color:initial;box-sizing:border-box;color:inherit;font:inherit;font-kerning:inherit;font-style:inherit;font-weight:inherit;letter-spacing:-.01px;line-height:inherit;margin:0;padding:0;pointer-events:auto;text-align:inherit;text-decoration:inherit}.xfaLayer :required{outline:1.5px solid red}.xfaLayer div,.xfaLayer svg,.xfaLayer svg *{pointer-events:none}.xfaLayer a{color:blue}.xfaRich li{margin-left:3em}.xfaFont{color:#000;font-kerning:none;font-size:10px;font-style:normal;font-weight:400;letter-spacing:0;text-decoration:none;vertical-align:0}.xfaCaption{flex:0 0 auto;overflow:hidden}.xfaCaptionForCheckButton{flex:1 1 auto;overflow:hidden}.xfaLabel{height:100%;width:100%}.xfaLeft{flex-direction:row}.xfaLeft,.xfaRight{align-items:center;display:flex}.xfaRight{flex-direction:row-reverse}:is(.xfaLeft,.xfaRight)>:is(.xfaCaption,.xfaCaptionForCheckButton){max-height:100%}.xfaTop{flex-direction:column}.xfaBottom,.xfaTop{align-items:flex-start;display:flex}.xfaBottom{flex-direction:column-reverse}:is(.xfaTop,.xfaBottom)>:is(.xfaCaption,.xfaCaptionForCheckButton){width:100%}.xfaBorder{background-color:initial;pointer-events:none;position:absolute}.xfaWrapped{height:100%;width:100%}:is(.xfaTextfield,.xfaSelect):focus{background-color:initial;background-image:none;outline:var(--xfa-focus-outline);outline-offset:-1px}:is(.xfaCheckbox,.xfaRadio):focus{outline:var(--xfa-focus-outline)}.xfaSelect,.xfaTextfield{background-image:var(--xfa-unfocused-field-background);border:none;flex:1 1 auto;height:100%;resize:none;width:100%}.xfaSelect{padding-inline:2px}:is(.xfaTop,.xfaBottom)>:is(.xfaTextfield,.xfaSelect){flex:0 1 auto}.xfaButton{border:none;cursor:pointer;text-align:center}.xfaButton,.xfaLink{height:100%;width:100%}.xfaLink{left:0;position:absolute;top:0}.xfaCheckbox,.xfaRadio{border:none;flex:0 0 auto;height:100%;width:100%}.xfaRich{white-space:pre-wrap}.xfaImage,.xfaRich{height:100%;width:100%}.xfaImage{-o-object-fit:contain;object-fit:contain;-o-object-position:left top;object-position:left top}.xfaLrTb,.xfaRlTb,.xfaTb{flex-direction:column}.xfaLr,.xfaLrTb,.xfaRlTb,.xfaTb{align-items:stretch;display:flex}.xfaLr{flex-direction:row}.xfaRl{align-items:stretch;display:flex;flex-direction:row-reverse}.xfaTb>div{justify-content:left}.xfaArea,.xfaPosition{position:relative}.xfaValignMiddle{align-items:center;display:flex}.xfaTable{flex-direction:column}.xfaTable,.xfaTable .xfaRow{align-items:stretch;display:flex}.xfaTable .xfaRow{flex-direction:row}.xfaTable .xfaRlRow{align-items:stretch;display:flex;flex:1;flex-direction:row-reverse}.xfaTable .xfaRlRow>div{flex:1}:is(.xfaNonInteractive,.xfaDisabled,.xfaReadOnly) :is(input,textarea){background:initial}@media print{.xfaSelect,.xfaTextfield{background:#0000}.xfaSelect{-webkit-appearance:none;-moz-appearance:none;appearance:none;text-indent:1px;text-overflow:""}}.canvasWrapper svg{transform:none}.moving:is(.canvasWrapper svg){z-index:100000}[data-main-rotation="90"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="90"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){transform:matrix(0,1,-1,0,1,0)}[data-main-rotation="180"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="180"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){transform:matrix(-1,0,0,-1,1,1)}[data-main-rotation="270"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="270"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){transform:matrix(0,-1,1,0,0,1)}.draw:is(.canvasWrapper svg){mix-blend-mode:normal;position:absolute}.draw[data-draw-rotation="90"]:is(.canvasWrapper svg){transform:rotate(90deg)}.draw[data-draw-rotation="180"]:is(.canvasWrapper svg){transform:rotate(180deg)}.draw[data-draw-rotation="270"]:is(.canvasWrapper svg){transform:rotate(270deg)}.highlight:is(.canvasWrapper svg){--blend-mode:multiply}@media screen and (forced-colors:active){.highlight:is(.canvasWrapper svg){--blend-mode:difference}}.highlight:is(.canvasWrapper svg){mix-blend-mode:var(--blend-mode);position:absolute}.highlight:is(.canvasWrapper svg):not(.free){fill-rule:evenodd}.highlightOutline:is(.canvasWrapper svg){fill-rule:evenodd;fill:none;mix-blend-mode:normal;position:absolute}.highlightOutline.hovered:is(.canvasWrapper svg):not(.free):not(.selected){stroke:var(--hover-outline-color);stroke-width:var(--outline-width)}.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .mainOutline{stroke:var(--outline-around-color);stroke-width:calc(var(--outline-width) + var(--outline-around-width)*2)}.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .secondaryOutline{stroke:var(--outline-color);stroke-width:var(--outline-width)}.highlightOutline.free.hovered:is(.canvasWrapper svg):not(.selected){stroke:var(--hover-outline-color);stroke-width:calc(var(--outline-width)*2)}.highlightOutline.free.selected:is(.canvasWrapper svg) .mainOutline{stroke:var(--outline-around-color);stroke-width:calc((var(--outline-width) + var(--outline-around-width))*2)}.highlightOutline.free.selected:is(.canvasWrapper svg) .secondaryOutline{stroke:var(--outline-color);stroke-width:calc(var(--outline-width)*2)}.toggle-button{--button-background-color:#f0f0f4;--button-background-color-hover:#e0e0e6;--button-background-color-active:#cfcfd8;--color-accent-primary:#0060df;--color-accent-primary-hover:#0250bb;--color-accent-primary-active:#054096;--border-interactive-color:#8f8f9d;--border-radius-circle:9999px;--border-width:1px;--size-item-small:16px;--size-item-large:32px;--color-canvas:#fff}@media (prefers-color-scheme:dark){.toggle-button{--button-background-color:color-mix(in srgb,currentColor 7%,#0000);--button-background-color-hover:color-mix(in srgb,currentColor 14%,#0000);--button-background-color-active:color-mix(in srgb,currentColor 21%,#0000);--color-accent-primary:#0df;--color-accent-primary-hover:#80ebff;--color-accent-primary-active:#aaf2ff;--border-interactive-color:#bfbfc9;--color-canvas:#1c1b22}}@media (forced-colors:active){.toggle-button{--color-accent-primary:ButtonText;--color-accent-primary-hover:SelectedItem;--color-accent-primary-active:SelectedItem;--border-interactive-color:ButtonText;--button-background-color:ButtonFace;--border-interactive-color-hover:SelectedItem;--border-interactive-color-active:SelectedItem;--border-interactive-color-disabled:GrayText;--color-canvas:ButtonText}}.toggle-button{--toggle-background-color:var(--button-background-color);--toggle-background-color-hover:var(--button-background-color-hover);--toggle-background-color-active:var(--button-background-color-active);--toggle-background-color-pressed:var(--color-accent-primary);--toggle-background-color-pressed-hover:var(--color-accent-primary-hover);--toggle-background-color-pressed-active:var(--color-accent-primary-active);--toggle-border-color:var(--border-interactive-color);--toggle-border-color-hover:var(--toggle-border-color);--toggle-border-color-active:var(--toggle-border-color);--toggle-border-radius:var(--border-radius-circle);--toggle-border-width:var(--border-width);--toggle-height:var(--size-item-small);--toggle-width:var(--size-item-large);--toggle-dot-background-color:var(--toggle-border-color);--toggle-dot-background-color-hover:var(--toggle-dot-background-color);--toggle-dot-background-color-active:var(--toggle-dot-background-color);--toggle-dot-background-color-on-pressed:var(--color-canvas);--toggle-dot-margin:1px;--toggle-dot-height:calc(var(--toggle-height) - var(--toggle-dot-margin)*2 - var(--toggle-border-width)*2);--toggle-dot-width:var(--toggle-dot-height);--toggle-dot-transform-x:calc(var(--toggle-width) - var(--toggle-dot-margin)*4 - var(--toggle-dot-width));-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--toggle-background-color);border:var(--toggle-border-width) solid var(--toggle-border-color);border-radius:var(--toggle-border-radius);box-sizing:border-box;flex-shrink:0;height:var(--toggle-height);margin:0;padding:0;width:var(--toggle-width)}.toggle-button:focus-visible{outline:var(--focus-outline);outline-offset:var(--focus-outline-offset)}.toggle-button:enabled:hover{background:var(--toggle-background-color-hover);border-color:var(--toggle-border-color)}.toggle-button:enabled:active{background:var(--toggle-background-color-active);border-color:var(--toggle-border-color)}.toggle-button[aria-pressed=true]{background:var(--toggle-background-color-pressed);border-color:#0000}.toggle-button[aria-pressed=true]:enabled:hover{background:var(--toggle-background-color-pressed-hover);border-color:#0000}.toggle-button[aria-pressed=true]:enabled:active{background:var(--toggle-background-color-pressed-active);border-color:#0000}.toggle-button:before{background-color:var(--toggle-dot-background-color);border-radius:var(--toggle-border-radius);content:"";display:block;height:var(--toggle-dot-height);margin:var(--toggle-dot-margin);translate:0;width:var(--toggle-dot-width)}.toggle-button[aria-pressed=true]:before{translate:var(--toggle-dot-transform-x)}.toggle-button[aria-pressed=true]:before,.toggle-button[aria-pressed=true]:enabled:active:before,.toggle-button[aria-pressed=true]:enabled:hover:before{background-color:var(--toggle-dot-background-color-on-pressed)}[dir=rtl] .toggle-button[aria-pressed=true]:before{translate:calc(var(--toggle-dot-transform-x)*-1)}@media (prefers-reduced-motion:no-preference){.toggle-button:before{transition:translate .1s}}@media (prefers-contrast){.toggle-button:enabled:hover{border-color:var(--toggle-border-color-hover)}.toggle-button:enabled:active{border-color:var(--toggle-border-color-active)}.toggle-button[aria-pressed=true]:enabled{border-color:var(--toggle-border-color);position:relative}.toggle-button[aria-pressed=true]:enabled:hover,.toggle-button[aria-pressed=true]:enabled:hover:active{border-color:var(--toggle-border-color-hover)}.toggle-button[aria-pressed=true]:enabled:active{background-color:var(--toggle-dot-background-color-active);border-color:var(--toggle-dot-background-color-hover)}.toggle-button:active:before,.toggle-button:hover:before{background-color:var(--toggle-dot-background-color-hover)}}@media (forced-colors){.toggle-button{--toggle-dot-background-color:var(--color-accent-primary);--toggle-dot-background-color-hover:var(--color-accent-primary-hover);--toggle-dot-background-color-active:var(--color-accent-primary-active);--toggle-dot-background-color-on-pressed:var(--button-background-color);--toggle-background-color-disabled:var(--button-background-color-disabled);--toggle-border-color-hover:var(--border-interactive-color-hover);--toggle-border-color-active:var(--border-interactive-color-active);--toggle-border-color-disabled:var(--border-interactive-color-disabled)}.toggle-button[aria-pressed=true]:enabled:after{border:1px solid var(--button-background-color);border-radius:var(--toggle-border-radius);content:"";display:block;height:var(--toggle-height);inset:-2px;position:absolute;width:var(--toggle-width)}.toggle-button[aria-pressed=true]:enabled:active:after{border-color:var(--toggle-border-color-active)}}:root{--outline-width:2px;--outline-color:#0060df;--outline-around-width:1px;--outline-around-color:#f0f0f4;--hover-outline-around-color:var(--outline-around-color);--focus-outline:solid var(--outline-width) var(--outline-color);--unfocus-outline:solid var(--outline-width) #0000;--focus-outline-around:solid var(--outline-around-width) var(--outline-around-color);--hover-outline-color:#8f8f9d;--hover-outline:solid var(--outline-width) var(--hover-outline-color);--hover-outline-around:solid var(--outline-around-width) var(--hover-outline-around-color);--freetext-line-height:1.35;--freetext-padding:2px;--resizer-bg-color:var(--outline-color);--resizer-size:6px;--resizer-shift:calc(0px - (var(--outline-width) + var(--resizer-size))/2 - var(--outline-around-width));--editorFreeText-editing-cursor:text;--editorInk-editing-cursor:url(images/cursor-editorInk.svg) 0 16,pointer;--editorHighlight-editing-cursor:url(images/cursor-editorTextHighlight.svg) 24 24,text;--editorFreeHighlight-editing-cursor:url(images/cursor-editorFreeHighlight.svg) 1 18,pointer;--new-alt-text-warning-image:url(images/altText_warning.svg)}.visuallyHidden{border:0;font-size:0;height:0;left:0;margin:0;overflow:hidden;padding:0;position:absolute;top:0;white-space:nowrap;width:0}.textLayer.highlighting{cursor:var(--editorFreeHighlight-editing-cursor)}.textLayer.highlighting:not(.free) span{cursor:var(--editorHighlight-editing-cursor)}.textLayer.highlighting.free span,[role=img]:is(.textLayer.highlighting:not(.free) span){cursor:var(--editorFreeHighlight-editing-cursor)}:is(#viewerContainer.pdfPresentationMode:fullscreen,.annotationEditorLayer.disabled) .noAltTextBadge{display:none!important}@media (min-resolution:1.1dppx){:root{--editorFreeText-editing-cursor:url(images/cursor-editorFreeText.svg) 0 16,text}}@media screen and (forced-colors:active){:root{--outline-color:CanvasText;--outline-around-color:ButtonFace;--resizer-bg-color:ButtonText;--hover-outline-color:Highlight;--hover-outline-around-color:SelectedItemText}}[data-editor-rotation="90"]{transform:rotate(90deg)}[data-editor-rotation="180"]{transform:rotate(180deg)}[data-editor-rotation="270"]{transform:rotate(270deg)}.annotationEditorLayer{background:#0000;cursor:auto;font-size:calc(100px*var(--scale-factor));inset:0;position:absolute;transform-origin:0 0}.annotationEditorLayer .selectedEditor{z-index:100000!important}.annotationEditorLayer.drawing *{pointer-events:none!important}.annotationEditorLayer.waiting{content:"";cursor:wait;height:100%;inset:0;position:absolute;width:100%}.annotationEditorLayer.disabled{pointer-events:none}.annotationEditorLayer.freetextEditing{cursor:var(--editorFreeText-editing-cursor)}.annotationEditorLayer.inkEditing{cursor:var(--editorInk-editing-cursor)}.annotationEditorLayer .draw{box-sizing:border-box}.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor){background:#0000;border:var(--unfocus-outline);cursor:auto;max-height:100%;max-width:100%;position:absolute;transform-origin:0 0;z-index:1}.draggable.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)){cursor:move}.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)){border:var(--focus-outline);outline:var(--focus-outline-around)}.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)):before{border:var(--focus-outline-around);content:"";inset:0;pointer-events:none;position:absolute}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)):hover:not(.selectedEditor){border:var(--hover-outline);outline:var(--hover-outline-around)}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor)):hover:not(.selectedEditor):before{border:var(--focus-outline-around);content:"";inset:0;position:absolute}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{--editor-toolbar-delete-image:url(images/editor-toolbar-delete.svg);--editor-toolbar-bg-color:#f0f0f4;--editor-toolbar-highlight-image:url(images/toolbarButton-editorHighlight.svg);--editor-toolbar-fg-color:#2e2e56;--editor-toolbar-border-color:#8f8f9d;--editor-toolbar-hover-border-color:var(--editor-toolbar-border-color);--editor-toolbar-hover-bg-color:#e0e0e6;--editor-toolbar-hover-fg-color:var(--editor-toolbar-fg-color);--editor-toolbar-hover-outline:none;--editor-toolbar-focus-outline-color:#0060df;--editor-toolbar-shadow:0 2px 6px 0 #3a394433;--editor-toolbar-vert-offset:6px;--editor-toolbar-height:28px;--editor-toolbar-padding:2px;--alt-text-done-color:#2ac3a2;--alt-text-warning-color:#0090ed;--alt-text-hover-done-color:var(--alt-text-done-color);--alt-text-hover-warning-color:var(--alt-text-warning-color)}@media (prefers-color-scheme:dark){:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{--editor-toolbar-bg-color:#2b2a33;--editor-toolbar-fg-color:#fbfbfe;--editor-toolbar-hover-bg-color:#52525e;--editor-toolbar-focus-outline-color:#0df;--alt-text-done-color:#54ffbd;--alt-text-warning-color:#80ebff}}@media screen and (forced-colors:active){:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{--editor-toolbar-bg-color:ButtonFace;--editor-toolbar-fg-color:ButtonText;--editor-toolbar-border-color:ButtonText;--editor-toolbar-hover-border-color:AccentColor;--editor-toolbar-hover-bg-color:ButtonFace;--editor-toolbar-hover-fg-color:AccentColor;--editor-toolbar-hover-outline:2px solid var(--editor-toolbar-hover-border-color);--editor-toolbar-focus-outline-color:ButtonBorder;--editor-toolbar-shadow:none;--alt-text-done-color:var(--editor-toolbar-fg-color);--alt-text-warning-color:var(--editor-toolbar-fg-color);--alt-text-hover-done-color:var(--editor-toolbar-hover-fg-color);--alt-text-hover-warning-color:var(--editor-toolbar-hover-fg-color)}}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar{align-items:center;background-color:var(--editor-toolbar-bg-color);border:1px solid var(--editor-toolbar-border-color);border-radius:6px;box-shadow:var(--editor-toolbar-shadow);box-sizing:initial;cursor:default;display:flex;flex-direction:column;height:var(--editor-toolbar-height);inset-block-start:calc(100% + var(--editor-toolbar-vert-offset));inset-inline-end:0;justify-content:center;padding:var(--editor-toolbar-padding);pointer-events:auto;position:absolute;width:-moz-fit-content;width:fit-content}.hidden:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){display:none}:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar):has(:focus-visible){border-color:#0000}[dir=ltr] :is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){transform-origin:100% 0}[dir=rtl] :is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar){transform-origin:0 0}:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons{align-items:center;display:flex;gap:0;height:100%;justify-content:center}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) button{padding:0}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .divider{border-left:1px solid var(--editor-toolbar-border-color);border-right:none;display:inline-block;height:calc(var(--editor-toolbar-padding)*2 + var(--editor-toolbar-height));margin-inline:2px;width:0}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton{width:var(--editor-toolbar-height)}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton):before{background-color:var(--editor-toolbar-fg-color);content:"";display:inline-block;height:100%;-webkit-mask-image:var(--editor-toolbar-highlight-image);mask-image:var(--editor-toolbar-highlight-image);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;width:100%}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .highlightButton):hover:before{background-color:var(--editor-toolbar-hover-fg-color)}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete{width:var(--editor-toolbar-height)}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete):before{background-color:var(--editor-toolbar-fg-color);content:"";display:inline-block;height:100%;-webkit-mask-image:var(--editor-toolbar-delete-image);mask-image:var(--editor-toolbar-delete-image);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;width:100%}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .delete):hover:before{background-color:var(--editor-toolbar-hover-fg-color)}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>*{height:var(--editor-toolbar-height)}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>:not(.divider){background-color:initial;border:none;cursor:pointer}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>:not(.divider)):hover{background-color:var(--editor-toolbar-hover-bg-color);border-radius:2px;color:var(--editor-toolbar-hover-fg-color);outline:var(--editor-toolbar-hover-outline);outline-offset:1px}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>:not(.divider)):hover:active{outline:none}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons)>:not(.divider)):focus-visible{border-radius:2px;outline:2px solid var(--editor-toolbar-focus-outline-color)}:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText{--alt-text-add-image:url(images/altText_add.svg);--alt-text-done-image:url(images/altText_done.svg);align-items:center;color:var(--editor-toolbar-fg-color);display:flex;font:menu;font-size:12px;font-weight:590;justify-content:center;padding-inline:8px;pointer-events:all;width:-moz-max-content;width:max-content}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):disabled{pointer-events:none}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):before{background-color:var(--editor-toolbar-fg-color);content:"";display:inline-block;height:13px;margin-inline-end:4px;-webkit-mask-image:var(--alt-text-add-image);mask-image:var(--alt-text-add-image);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;width:12px}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover:before{background-color:var(--editor-toolbar-hover-fg-color)}.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):before{-webkit-mask-image:var(--alt-text-done-image);mask-image:var(--alt-text-done-image)}.new:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):before{background-color:var(--alt-text-warning-color);height:16px;-webkit-mask-image:var(--new-alt-text-warning-image);mask-image:var(--new-alt-text-warning-image);-webkit-mask-size:cover;mask-size:cover;width:16px}.new:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover:before{background-color:var(--alt-text-hover-warning-color)}.new.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):before{background-color:var(--alt-text-done-color);-webkit-mask-image:var(--alt-text-done-image);mask-image:var(--alt-text-done-image)}.new.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText):hover:before{background-color:var(--alt-text-hover-done-color)}:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip{word-wrap:anywhere;display:none}.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){--alt-text-tooltip-bg:#f0f0f4;--alt-text-tooltip-fg:#15141a;--alt-text-tooltip-border:#8f8f9d;--alt-text-tooltip-shadow:0px 2px 6px 0px #3a394433}@media (prefers-color-scheme:dark){.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){--alt-text-tooltip-bg:#1c1b22;--alt-text-tooltip-fg:#fbfbfe;--alt-text-tooltip-shadow:0px 2px 6px 0px #15141a}}@media screen and (forced-colors:active){.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){--alt-text-tooltip-bg:Canvas;--alt-text-tooltip-fg:CanvasText;--alt-text-tooltip-border:CanvasText;--alt-text-tooltip-shadow:none}}.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){align-items:center;background:var(--alt-text-tooltip-bg);border:.5px solid var(--alt-text-tooltip-border);box-shadow:var(--alt-text-tooltip-shadow);color:var(--alt-text-tooltip-fg);display:inline-flex;flex-direction:column;font-size:12px;height:auto;inset-inline-start:0;justify-content:center;max-width:300px;padding-block:2px 3px;padding-inline:3px;pointer-events:none;position:absolute;top:calc(100% + 2px);width:-moz-max-content;width:max-content}.annotationEditorLayer .freeTextEditor{height:auto;padding:calc(var(--freetext-padding)*var(--scale-factor));touch-action:none;width:auto}.annotationEditorLayer .freeTextEditor .internal{background:#0000;border:none;font:10px sans-serif;inset:0;line-height:var(--freetext-line-height);overflow:visible;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.annotationEditorLayer .freeTextEditor .overlay{background:#0000;display:none;height:100%;inset:0;position:absolute;width:100%}.annotationEditorLayer freeTextEditor .overlay.enabled{display:block}.annotationEditorLayer .freeTextEditor .internal:empty:before{color:gray;content:attr(default-content)}.annotationEditorLayer .freeTextEditor .internal:focus{outline:none;-webkit-user-select:auto;-moz-user-select:auto;user-select:auto}.annotationEditorLayer .inkEditor{height:100%;width:100%}.annotationEditorLayer .inkEditor.editing{cursor:inherit}.annotationEditorLayer .inkEditor .inkEditorCanvas{height:100%;inset:0;position:absolute;touch-action:none;width:100%}.annotationEditorLayer .stampEditor{height:auto;width:auto}:is(.annotationEditorLayer .stampEditor) canvas{height:100%;left:0;margin:0;position:absolute;top:0;width:100%}:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{--no-alt-text-badge-border-color:#f0f0f4;--no-alt-text-badge-bg-color:#cfcfd8;--no-alt-text-badge-fg-color:#5b5b66}@media (prefers-color-scheme:dark){:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{--no-alt-text-badge-border-color:#52525e;--no-alt-text-badge-bg-color:#fbfbfe;--no-alt-text-badge-fg-color:#15141a}}@media screen and (forced-colors:active){:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{--no-alt-text-badge-border-color:ButtonText;--no-alt-text-badge-bg-color:ButtonFace;--no-alt-text-badge-fg-color:ButtonText}}:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{align-items:center;background:var(--no-alt-text-badge-bg-color);border:1px solid var(--no-alt-text-badge-border-color);border-radius:2px;display:inline-flex;height:32px;inset-block-end:5px;inset-inline-end:5px;justify-content:center;padding:3px;pointer-events:none;position:absolute;width:32px;z-index:1}:is(:is(.annotationEditorLayer .stampEditor) .noAltTextBadge):before{background-color:var(--no-alt-text-badge-fg-color);content:"";display:inline-block;height:16px;-webkit-mask-image:var(--new-alt-text-warning-image);mask-image:var(--new-alt-text-warning-image);-webkit-mask-size:cover;mask-size:cover;width:16px}:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers{inset:0;position:absolute}.hidden:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers){display:none}:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer{background:content-box var(--resizer-bg-color);border:var(--focus-outline-around);border-radius:2px;height:var(--resizer-size);position:absolute;width:var(--resizer-size)}.topLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){left:var(--resizer-shift);top:var(--resizer-shift)}.topMiddle:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){left:calc(50% + var(--resizer-shift));top:var(--resizer-shift)}.topRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){right:var(--resizer-shift);top:var(--resizer-shift)}.middleRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){right:var(--resizer-shift);top:calc(50% + var(--resizer-shift))}.bottomRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){bottom:var(--resizer-shift);right:var(--resizer-shift)}.bottomMiddle:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){bottom:var(--resizer-shift);left:calc(50% + var(--resizer-shift))}.bottomLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){bottom:var(--resizer-shift);left:var(--resizer-shift)}.middleLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor))>.resizers)>.resizer){left:var(--resizer-shift);top:calc(50% + var(--resizer-shift))}.bottomRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer),.topLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer){cursor:nwse-resize}.bottomMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer),.topMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer){cursor:ns-resize}.bottomLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer),.topRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer){cursor:nesw-resize}.middleLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer),.middleRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]))>.resizers>.resizer){cursor:ew-resize}.bottomRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer),.topLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer){cursor:nesw-resize}.bottomMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer),.topMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer){cursor:ew-resize}.bottomLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer),.topRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer){cursor:nwse-resize}.middleLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer),.middleRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]))>.resizers>.resizer){cursor:ns-resize}:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar{rotate:270deg}[dir=ltr] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar){inset-block-start:0;inset-inline-end:calc(0px - var(--editor-toolbar-vert-offset))}[dir=rtl] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar){inset-block-start:0;inset-inline-end:calc(100% + var(--editor-toolbar-vert-offset))}:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="180"],[data-main-rotation="90"] [data-editor-rotation="90"],[data-main-rotation="180"] [data-editor-rotation="0"],[data-main-rotation="270"] [data-editor-rotation="270"])) .editToolbar{inset-block-start:calc(0pc - var(--editor-toolbar-vert-offset));inset-inline-end:100%;rotate:180deg}:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar{rotate:90deg}[dir=ltr] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar){inset-block-start:100%;inset-inline-end:calc(100% + var(--editor-toolbar-vert-offset))}[dir=rtl] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar){inset-block-start:0;inset-inline-start:calc(0px - var(--editor-toolbar-vert-offset))}.dialog.altText::backdrop{-webkit-mask:url(#alttext-manager-mask);mask:url(#alttext-manager-mask)}.dialog.altText.positioned{margin:0}.dialog.altText #altTextContainer{align-items:flex-start;display:inline-flex;flex-direction:column;gap:16px;height:-moz-fit-content;height:fit-content;width:300px}:is(.dialog.altText #altTextContainer) #overallDescription{align-items:flex-start;align-self:stretch;display:flex;flex-direction:column;gap:4px}:is(:is(.dialog.altText #altTextContainer) #overallDescription) span{align-self:stretch}:is(:is(.dialog.altText #altTextContainer) #overallDescription) .title{font-size:13px;font-style:normal;font-weight:590}:is(.dialog.altText #altTextContainer) #addDescription{align-items:stretch;display:flex;flex-direction:column;gap:8px}:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea{flex:1;padding-inline:24px 10px}:is(:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea) textarea{min-height:75px;width:100%}:is(.dialog.altText #altTextContainer) #buttons{align-items:flex-start;align-self:stretch;display:flex;gap:8px;justify-content:flex-end}.dialog.newAltText{--new-alt-text-ai-disclaimer-icon:url(images/altText_disclaimer.svg);--new-alt-text-spinner-icon:url(images/altText_spinner.svg);--preview-image-bg-color:#f0f0f4;--preview-image-border:none}@media (prefers-color-scheme:dark){.dialog.newAltText{--preview-image-bg-color:#2b2a33}}@media screen and (forced-colors:active){.dialog.newAltText{--preview-image-bg-color:ButtonFace;--preview-image-border:1px solid ButtonText}}.dialog.newAltText{max-width:570px;min-width:300px;padding:0;width:80%}.dialog.newAltText.aiInstalling #newAltTextCreateAutomatically,.dialog.newAltText.noAi #newAltTextCreateAutomatically,.dialog.newAltText.noAi #newAltTextDisclaimer{display:none!important}.dialog.newAltText.aiInstalling #newAltTextDownloadModel{display:flex!important}.dialog.newAltText.error #newAltTextNotNow{display:none!important}.dialog.newAltText.error #newAltTextCancel{display:inline-block!important}.dialog.newAltText:not(.error) #newAltTextError{display:none!important}.dialog.newAltText #newAltTextContainer{align-items:flex-start;display:flex;flex:0 1 auto;flex-direction:column;gap:12px;justify-content:flex-end;line-height:normal;padding:16px;width:auto}:is(.dialog.newAltText #newAltTextContainer) #mainContent{align-items:flex-start;align-self:stretch;display:flex;flex:1 1 auto;gap:12px;justify-content:flex-end}:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionAndSettings{align-items:flex-start;align-self:stretch;display:flex;flex:1 0 0;flex-direction:column;gap:16px}:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction{align-items:flex-start;align-self:stretch;display:flex;flex:1 1 auto;flex-direction:column;gap:8px}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer{height:70px;position:relative;width:100%}:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea{height:100%;padding:8px;width:100%}:is(:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea)::-moz-placeholder{color:var(--text-secondary-color)}:is(:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea)::placeholder{color:var(--text-secondary-color)}:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) .altTextSpinner{background-color:var(--text-secondary-color);display:none;height:16px;inset-block-start:8px;inset-inline-start:8px;-webkit-mask-size:cover;mask-size:cover;pointer-events:none;position:absolute;width:16px}.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea::-moz-placeholder{color:#0000}.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea::placeholder{color:#0000}.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) .altTextSpinner{display:inline-block;-webkit-mask-image:var(--new-alt-text-spinner-icon);mask-image:var(--new-alt-text-spinner-icon)}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescription{font-size:11px}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDisclaimer{align-items:flex-start;display:flex;flex-direction:row;font-size:11px;gap:4px}:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDisclaimer):before{background-color:var(--text-secondary-color);content:"";display:inline-block;flex:1 0 auto;height:16px;-webkit-mask-image:var(--new-alt-text-ai-disclaimer-icon);mask-image:var(--new-alt-text-ai-disclaimer-icon);-webkit-mask-size:cover;mask-size:cover;width:17px}:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextDownloadModel{align-items:center;align-self:stretch;display:flex;gap:4px}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextDownloadModel):before{background-color:var(--text-secondary-color);content:"";display:inline-block;height:16px;-webkit-mask-image:var(--new-alt-text-spinner-icon);mask-image:var(--new-alt-text-spinner-icon);-webkit-mask-size:cover;mask-size:cover;width:16px}:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextImagePreview{align-items:center;aspect-ratio:1;background-color:var(--preview-image-bg-color);border:var(--preview-image-border);display:flex;flex:0 0 auto;justify-content:center;width:180px}:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextImagePreview)>canvas{max-height:100%;max-width:100%}.colorPicker{--hover-outline-color:#0250bb;--selected-outline-color:#0060df;--swatch-border-color:#cfcfd8}@media (prefers-color-scheme:dark){.colorPicker{--hover-outline-color:#80ebff;--selected-outline-color:#aaf2ff;--swatch-border-color:#52525e}}@media screen and (forced-colors:active){.colorPicker{--hover-outline-color:Highlight;--selected-outline-color:var(--hover-outline-color);--swatch-border-color:ButtonText}}.colorPicker .swatch{border:1px solid var(--swatch-border-color);border-radius:100%;box-sizing:border-box;forced-color-adjust:none;height:16px;outline-offset:2px;width:16px}.colorPicker button:is(:hover,.selected)>.swatch{border:none}.annotationEditorLayer[data-main-rotation="0"] .highlightEditor:not(.free)>.editToolbar{rotate:0deg}.annotationEditorLayer[data-main-rotation="90"] .highlightEditor:not(.free)>.editToolbar{rotate:270deg}.annotationEditorLayer[data-main-rotation="180"] .highlightEditor:not(.free)>.editToolbar{rotate:180deg}.annotationEditorLayer[data-main-rotation="270"] .highlightEditor:not(.free)>.editToolbar{rotate:90deg}.annotationEditorLayer .highlightEditor{background:#0000;border:none;cursor:auto;max-height:100%;max-width:100%;outline:none;pointer-events:none;position:absolute;transform-origin:0 0;z-index:1}:is(.annotationEditorLayer .highlightEditor):not(.free){transform:none}:is(.annotationEditorLayer .highlightEditor) .internal{height:100%;left:0;pointer-events:auto;position:absolute;top:0;width:100%}.disabled:is(.annotationEditorLayer .highlightEditor) .internal{pointer-events:none}.selectedEditor:is(.annotationEditorLayer .highlightEditor) .internal{cursor:pointer}:is(.annotationEditorLayer .highlightEditor) .editToolbar{--editor-toolbar-colorpicker-arrow-image:url(images/toolbarButton-menuArrow.svg);transform-origin:center!important}:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker{align-items:center;display:flex;gap:4px;justify-content:center;padding:4px;position:relative;width:auto}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):after{background-color:var(--editor-toolbar-fg-color);content:"";display:inline-block;height:12px;-webkit-mask-image:var(--editor-toolbar-colorpicker-arrow-image);mask-image:var(--editor-toolbar-colorpicker-arrow-image);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;width:12px}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):hover:after{background-color:var(--editor-toolbar-hover-fg-color)}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):has(.dropdown:not(.hidden)){background-color:var(--editor-toolbar-hover-bg-color)}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):has(.dropdown:not(.hidden)):after{scale:-1}:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown{align-items:center;background-color:var(--editor-toolbar-bg-color);border:1px solid var(--editor-toolbar-border-color);border-radius:6px;box-shadow:var(--editor-toolbar-shadow);display:flex;flex-direction:column;gap:11px;inset-block-start:calc(100% + 4px);justify-content:center;padding-block:8px;position:absolute;width:calc(100% + var(--editor-toolbar-padding)*2)}:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button{align-items:center;background:none;border:none;cursor:pointer;display:flex;height:auto;justify-content:center;width:100%}:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button):is(:active,:focus-visible){outline:none}:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button)>.swatch{outline-offset:2px}[aria-selected=true]:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button)>.swatch{outline:2px solid var(--selected-outline-color)}:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button):is(:hover,:active,:focus-visible)>.swatch{outline:2px solid var(--hover-outline-color)}.editorParamsToolbar:has(#highlightParamsToolbarContainer){padding:unset}#highlightParamsToolbarContainer{gap:16px;padding-block-end:12px;padding-inline:10px}#highlightParamsToolbarContainer .colorPicker{display:flex;flex-direction:column;gap:8px}:is(#highlightParamsToolbarContainer .colorPicker) .dropdown{align-items:center;display:flex;flex-direction:row;height:auto;justify-content:space-between}:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button{align-items:center;background:none;border:none;cursor:pointer;display:flex;flex:0 0 auto;height:auto;justify-content:center;padding:0;width:auto}:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button) .swatch{height:24px;width:24px}:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button):is(:active,:focus-visible){outline:none}[aria-selected=true]:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button)>.swatch{outline:2px solid var(--selected-outline-color)}:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button):is(:hover,:active,:focus-visible)>.swatch{outline:2px solid var(--hover-outline-color)}#highlightParamsToolbarContainer #editorHighlightThickness{align-items:center;align-self:stretch;display:flex;flex-direction:column;gap:4px}:is(#highlightParamsToolbarContainer #editorHighlightThickness) .editorParamsLabel{align-self:stretch;height:auto}:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{--example-color:#bfbfc9;align-items:center;align-self:stretch;display:flex;justify-content:space-between}@media (prefers-color-scheme:dark){:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{--example-color:#80808e}}@media screen and (forced-colors:active){:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{--example-color:CanvasText}}:is(:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker)>.editorParamsSlider[disabled]){opacity:.4}:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker):after,:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker):before{aspect-ratio:1;background-color:var(--example-color);border-radius:100%;content:"";display:block;width:8px}:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker):after{width:24px}:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker) .editorParamsSlider{height:14px;width:unset}#highlightParamsToolbarContainer #editorHighlightVisibility{align-items:flex-start;align-self:stretch;display:flex;flex-direction:column;gap:8px}:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{--divider-color:#d7d7db}@media (prefers-color-scheme:dark){:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{--divider-color:#8f8f9d}}@media screen and (forced-colors:active){:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{--divider-color:CanvasText}}:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{background-color:var(--divider-color);height:1px;margin-block:4px;width:100%}:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .toggler{align-items:center;align-self:stretch;display:flex;justify-content:space-between}#altTextSettingsDialog{padding:16px}#altTextSettingsDialog #altTextSettingsContainer{display:flex;flex-direction:column;gap:16px;width:573px}:is(#altTextSettingsDialog #altTextSettingsContainer) .mainContainer{gap:16px}:is(#altTextSettingsDialog #altTextSettingsContainer) .description{color:var(--text-secondary-color)}:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings{display:flex;flex-direction:column;gap:12px}:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) button{width:-moz-fit-content;width:fit-content}.download:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) #deleteModelButton,:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings):not(.download) #downloadModelButton{display:none}:is(#altTextSettingsDialog #altTextSettingsContainer) #altTextEditor,:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticAltText{display:flex;flex-direction:column;gap:8px}:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings,:is(#altTextSettingsDialog #altTextSettingsContainer) #createModelDescription,:is(#altTextSettingsDialog #altTextSettingsContainer) #showAltTextDialogDescription{padding-inline-start:40px}:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticSettings{display:flex;flex-direction:column;gap:16px}:root{--viewer-container-height:0;--pdfViewer-padding-bottom:0;--page-margin:1px auto -8px;--page-border:9px solid #0000;--spreadHorizontalWrapped-margin-LR:-3.5px;--loading-icon-delay:400ms}@media screen and (forced-colors:active){:root{--pdfViewer-padding-bottom:9px;--page-margin:8px auto -1px;--page-border:1px solid CanvasText;--spreadHorizontalWrapped-margin-LR:3.5px}}[data-main-rotation="90"]{transform:rotate(90deg) translateY(-100%)}[data-main-rotation="180"]{transform:rotate(180deg) translate(-100%,-100%)}[data-main-rotation="270"]{transform:rotate(270deg) translateX(-100%)}#hiddenCopyElement,.hiddenCanvasElement{display:none;height:0;left:0;position:absolute;top:0;width:0}.pdfViewer{--scale-factor:1;--page-bg-color:unset;--hcm-highlight-filter:none;--hcm-highlight-selected-filter:none;padding-bottom:var(--pdfViewer-padding-bottom)}@media screen and (forced-colors:active){.pdfViewer{--hcm-highlight-filter:invert(100%)}}.pdfViewer.copyAll{cursor:wait}.pdfViewer .canvasWrapper{height:100%;overflow:hidden;width:100%}:is(.pdfViewer .canvasWrapper) canvas{contain:content;display:block;height:100%;left:0;margin:0;position:absolute;top:0;width:100%}:is(:is(.pdfViewer .canvasWrapper) canvas) .structTree{contain:strict}.pdfViewer .page{--scale-round-x:1px;--scale-round-y:1px;background-clip:content-box;background-color:var(--page-bg-color,#fff);border:var(--page-border);direction:ltr;height:1056px;margin:var(--page-margin);overflow:visible;position:relative;width:816px}.pdfViewer .dummyPage{height:var(--viewer-container-height);position:relative;width:0}.pdfViewer.noUserSelect{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pdfViewer.removePageBorders .page{border:none;margin:0 auto 10px}.pdfViewer.singlePageView{display:inline-block}.pdfViewer.singlePageView .page{border:none;margin:0}.pdfViewer:is(.scrollHorizontal,.scrollWrapped),.spread{margin-inline:3.5px;text-align:center}.pdfViewer.scrollHorizontal,.spread{white-space:nowrap}.pdfViewer.removePageBorders,.pdfViewer:is(.scrollHorizontal,.scrollWrapped) .spread{margin-inline:0}.pdfViewer:is(.scrollHorizontal,.scrollWrapped) :is(.page,.spread),.spread :is(.page,.dummyPage){display:inline-block;vertical-align:middle}.pdfViewer:is(.scrollHorizontal,.scrollWrapped) .page,.spread .page{margin-inline:var(--spreadHorizontalWrapped-margin-LR)}.pdfViewer.removePageBorders .spread .page,.pdfViewer.removePageBorders:is(.scrollHorizontal,.scrollWrapped) .page{margin-inline:5px}.pdfViewer .page.loadingIcon:after{background:url(images/loading-icon.gif) 50% no-repeat;contain:strict;content:"";display:none;height:100%;left:0;position:absolute;top:0;transition-delay:var(--loading-icon-delay);transition-property:display;width:100%;z-index:5}.pdfViewer .page.loading:after{display:block}.pdfViewer .page:not(.loading):after{display:none;transition-property:none}.pdfPresentationMode .pdfViewer{padding-bottom:0}.pdfPresentationMode .spread{margin:0}.pdfPresentationMode .pdfViewer .page{border:2px solid #0000;margin:0 auto}');var Wie=function(){function e(){}return e.generateUniqueId=function(){var e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return"".concat(e,"-").concat(t)},e}(),$ie=Symbol.for("immer-nothing"),qie=Symbol.for("immer-draftable"),Gie=Symbol.for("immer-state"),Yie="production"!==St.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Kie(e,...t){if("production"!==St.env.NODE_ENV){const n=Yie[e],r="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Xie=Object.getPrototypeOf;function Qie(e){return!!e&&!!e[Gie]}function Jie(e){return!!e&&(ele(e)||Array.isArray(e)||!!e[qie]||!!e.constructor?.[qie]||ole(e)||cle(e))}var Zie=Object.prototype.constructor.toString();function ele(e){if(!e||"object"!=typeof e)return!1;const t=Xie(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Zie}function tle(e,t){0===nle(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function nle(e){const t=e[Gie];return t?t.type_:Array.isArray(e)?1:ole(e)?2:cle(e)?3:0}function rle(e,t){return 2===nle(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ale(e,t,n){const r=nle(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ole(e){return e instanceof Map}function cle(e){return e instanceof Set}function ile(e){return e.copy_||e.base_}function lle(e,t){if(ole(e))return new Map(e);if(cle(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=ele(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Gie];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const a=n[r],o=t[a];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[a]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[a]})}return Object.create(Xie(e),t)}{const t=Xie(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function sle(e,t=!1){return dle(e)||Qie(e)||!Jie(e)||(nle(e)>1&&(e.set=e.add=e.clear=e.delete=hle),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>sle(t,!0)))),e}function hle(){Kie(2)}function dle(e){return Object.isFrozen(e)}var ule,mle={};function ple(e){const t=mle[e];return t||Kie(0,e),t}function vle(){return ule}function fle(e,t){t&&(ple("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function zle(e){gle(e),e.drafts_.forEach(Mle),e.drafts_=null}function gle(e){e===ule&&(ule=e.parent_)}function yle(e){return ule={drafts_:[],parent_:ule,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Mle(e){const t=e[Gie];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ele(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Gie].modified_&&(zle(t),Kie(4)),Jie(e)&&(e=ble(t,e),t.parent_||Vle(t,e)),t.patches_&&ple("Patches").generateReplacementPatches_(n[Gie].base_,e,t.patches_,t.inversePatches_)):e=ble(t,n,[]),zle(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$ie?e:void 0}function ble(e,t,n){if(dle(t))return t;const r=t[Gie];if(!r)return tle(t,((a,o)=>Hle(e,r,t,a,o,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return Vle(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let a=t,o=!1;3===r.type_&&(a=new Set(t),t.clear(),o=!0),tle(a,((a,c)=>Hle(e,r,t,a,c,n,o))),Vle(e,t,!1),n&&e.patches_&&ple("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Hle(e,t,n,r,a,o,c){if("production"!==St.env.NODE_ENV&&a===n&&Kie(5),Qie(a)){const c=ble(e,a,o&&t&&3!==t.type_&&!rle(t.assigned_,r)?o.concat(r):void 0);if(ale(n,r,c),!Qie(c))return;e.canAutoFreeze_=!1}else c&&n.add(a);if(Jie(a)&&!dle(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ble(e,a),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||Vle(e,a)}}function Vle(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sle(t,n)}var Cle={get(e,t){if(t===Gie)return e;const n=ile(e);if(!rle(n,t))return function(e,t,n){const r=wle(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Jie(r)?r:r===kle(e.base_,t)?(xle(e),e.copy_[t]=Tle(r,e)):r},has:(e,t)=>t in ile(e),ownKeys:e=>Reflect.ownKeys(ile(e)),set(e,t,n){const r=wle(ile(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=kle(ile(e),t),c=r?.[Gie];if(c&&c.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((a=n)===(o=r)?0!==a||1/a==1/o:a!=a&&o!=o)&&(void 0!==n||rle(e.base_,t)))return!0;xle(e),Sle(e)}var a,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==kle(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,xle(e),Sle(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ile(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Kie(11)},getPrototypeOf:e=>Xie(e.base_),setPrototypeOf(){Kie(12)}},Lle={};function kle(e,t){const n=e[Gie];return(n?ile(n):e)[t]}function wle(e,t){if(!(t in e))return;let n=Xie(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Xie(n)}}function Sle(e){e.modified_||(e.modified_=!0,e.parent_&&Sle(e.parent_))}function xle(e){e.copy_||(e.copy_=lle(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function Tle(e,t){const n=ole(e)?ple("MapSet").proxyMap_(e,t):cle(e)?ple("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:vle(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,o=Cle;n&&(a=[r],o=Lle);const{revoke:c,proxy:i}=Proxy.revocable(a,o);return r.draft_=i,r.revoke_=c,i}(e,t);return(t?t.scope_:vle()).drafts_.push(n),n}function Ole(e){if(!Jie(e)||dle(e))return e;const t=e[Gie];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=lle(e,t.scope_.immer_.useStrictShallowCopy_)}else n=lle(e,!0);return tle(n,((e,t)=>{ale(n,e,Ole(t))})),t&&(t.finalized_=!1),n}tle(Cle,((e,t)=>{Lle[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Lle.deleteProperty=function(e,t){return"production"!==St.env.NODE_ENV&&isNaN(parseInt(t))&&Kie(13),Lle.set.call(this,e,t,void 0)},Lle.set=function(e,t,n){return"production"!==St.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Kie(14),Cle.set.call(this,e[0],t,n,e[0])};var Ale=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...a){return r.produce(e,(e=>t.call(this,e,...a)))}}let r;if("function"!=typeof t&&Kie(6),void 0!==n&&"function"!=typeof n&&Kie(7),Jie(e)){const a=yle(this),o=Tle(e,void 0);let c=!0;try{r=t(o),c=!1}finally{c?zle(a):gle(a)}return fle(a,n),Ele(r,a)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===$ie&&(r=void 0),this.autoFreeze_&&sle(r,!0),n){const t=[],a=[];ple("Patches").generateReplacementPatches_(e,r,t,a),n(t,a)}return r}Kie(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Jie(e)||Kie(8),Qie(e)&&(e=function(e){return Qie(e)||Kie(10,e),Ole(e)}(e));const t=yle(this),n=Tle(e,void 0);return n[Gie].isManual_=!0,gle(t),n}finishDraft(e,t){const n=e&&e[Gie];n&&n.isManual_||Kie(9);const{scope_:r}=n;return fle(r,t),Ele(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ple("Patches").applyPatches_;return Qie(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Rle=Ale.produce;Ale.produceWithPatches.bind(Ale);var Nle=Ale.setAutoFreeze.bind(Ale);Ale.setUseStrictShallowCopy.bind(Ale),Ale.applyPatches.bind(Ale),Ale.createDraft.bind(Ale),Ale.finishDraft.bind(Ale);var _le={isScaleSaveHappening:!1,isAddNewScaleFormPopupOpen:!1,scaleName:"",paperDimension:{unitOfMeasurement:"inch",scalarQuantity:1},displayDimension:{unitOfMeasurement:"inch",scalarQuantity:1},precision:.1,userCalibratingScaleOnPdfPageDetails:{isHappening:!1,coordinates:[]},isCalibrationScaleFormPopupOpen:!1,pdfPageId:""},Dle={scaleId:"",popup:{isOpen:!1},paperDimension:{unitOfMeasurement:"inch",scalarQuantity:0},displayDimension:{unitOfMeasurement:"inch",scalarQuantity:0},scaleName:"",precision:.1,isScaleSaveHappening:!1},Ple=function(){function e(){}return e.getEnvValue=function(e){var t,n=null===(t=null===window||void 0===window?void 0:window._env_)||void 0===t?void 0:t[e];return n&&"default"!==n?n:""},e}(),Fle=function(){function e(){}return e.BACKEND_BASE_URL=Ple.getEnvValue("BACKEND_BASE_URL"),e.scalePrecisionOptions=[.1,.01,.001],e.annotationAvalaibleColors=[{color:"#E34234"},{color:"#FF8D02"},{color:"#FFCD44"},{color:"#5BC96D"},{color:"#26D2D2"},{color:"#587CE2"},{color:"#C544CE"},{color:"#7D2E25"},{color:"#A84F1C"},{color:"#E99E38"},{color:"#347842"},{color:"#167E7D"},{color:"#354A87"},{color:"#76287B"},{color:"#000"},{color:"#CDCDCD"},{color:"#9C9C9C"},{color:"#696969"},{color:"#272727"},{color:"#FFFFFF"}],e.pdfPagesElementId="pdf-pages-container",e}(),Ile={isOpen:!1,sections:{color:{collapsedStatus:"collapsed",currentlySelectedColor:Fle.annotationAvalaibleColors[0].color},coordinates:{collapsedStatus:"collapsed",shouldHighlightFirstCoordinate:!1,shouldHighlightSecondCoordinate:!1,x1:0,x2:0,y1:0,y2:0}}};Iie.workerSrc="https://unpkg.com/pdfjs-dist@4.10.38/build/pdf.worker.min.mjs",Nle(!1);var Ble={options:{showDividerBetweenToolSections:!0,alignmentOfFirstRowToolSections:"space-between"},sections:[[{name:"fullScreen"},{name:"zoomTool"}],[{name:"Annotation",children:[{name:"highlight"},{name:"callout"}]},{name:"Shapes",children:[{name:"rectangle"}]},{name:"Measure",children:[{name:"measureDistance"}]}],[{name:"toggleTextSelectionTool"},{name:"eyeTool"},{name:"comment"}]]};function jle(e){var t=this,r=c([]),a=r[0],o=r[1],d=c(""),u=d[0],m=d[1],p=c(""),v=p[0],f=p[1],z=c({pdfEditorToolsToShow:e.toolsToShow||Ble,toolsRelatedData:{},measureToolRelatedData:{scaleIdSelected:"",addNewScaleDetails:_le,editScaleDetails:Dle,distanceAnnotation:{configurationsDrawer:Ile,isFirstPointSelected:!1,isSecondPointSelected:!1}},textHighlightToolRelatedData:{isTextSelectionEnabled:!0,selectedTextToolBoxDetails:{pdfPageId:"",x:0,y:0}}}),g=z[0],y=z[1],M=c(e.currentUserId),E=M[0],b=M[1],H=c([]),V=H[0],C=H[1],L=c([]),k=L[0],w=L[1],S=c(!1),x=S[0],T=S[1],O=c(0),A=O[0],R=O[1],N=c(!1),_=N[0],D=N[1],P=c(!1),F=P[0],I=P[1],B=c(e.areAnnotationsVisibleByDefault),j=B[0],U=B[1],W=c(""),$=W[0],q=W[1],G=c(""),Y=G[0],K=G[1],X=e.rectangleAnnotationToolOptions,Q=e.backendBaseUrl,J=e.rlefEventServiceBaseUrl,Z=i(new Sre({backendBaseUrl:Q})),ee=c(Wie.generateUniqueId()),te=ee[0];ee[1];var ne=c([]),re=ne[0],ae=ne[1],oe=l((function(e){ae((function(t){return Q7(Q7([],t,!0),[e],!1)}))}),[ae]),ce=l((function(e,n){return K7(t,void 0,void 0,(function(){var t,r;return X7(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,3,4]),T(!0),[4,Z.current.fetchUsersOfPdf({pdfId:n,userNameSearchKey:e,limit:10,offset:1})];case 1:return(t=a.sent())&&w(t),[3,4];case 2:return r=a.sent(),console.error("Error fetching suggested users: ",r),[3,4];case 3:return T(!1),[7];case 4:return[2]}}))}))}),[]),ie=l((function(e){ae((function(t){return Q7([],t.filter((function(t){return t!==e})),!0)}))}),[ae]),le=l((function(){return K7(t,void 0,void 0,(function(){var t,n,r,o,c;return X7(this,(function(i){switch(i.label){case 0:if(!(t=(null===(c=a[0])||void 0===c?void 0:c._id)||""))return[2];i.label=1;case 1:return i.trys.push([1,5,,6]),I(!0),[4,Z.current.fetchUsersOfPdf({pdfId:t})];case 2:return(n=i.sent())?-1!==n.findIndex((function(t){return t._id===e.currentUserId}))?[3,4]:[4,Z.current.fetchUsersOfPdf({pdfId:t,userIds:[e.currentUserId]})]:[2];case 3:(r=i.sent())&&r.length>0&&n.push(r[0]),i.label=4;case 4:return C(n),[3,6];case 5:return o=i.sent(),console.error("Error fetching users: ",o),[3,6];case 6:return[2]}}))}))}),[a]);s((function(){F||le()}),[le,F]);var se=c([]);se[0];var he=se[1],de=c({isEditingText:!1,annotationId:"",pdfId:"",pdfPageId:"",color:"",points:[],text:""}),ue=de[0],me=de[1],pe=l((function(e,n){return K7(t,void 0,void 0,(function(){var t,r,a,c,i,l,s,h,d,u,m,p,v;return X7(this,(function(f){switch(f.label){case 0:return t=(n||{}).pdfSourceUrl,e&&oe(e),r={},e&&(r.pdfId=e),t&&(r.pdfSourceUrl=t),a=Z.current.fetchOnlyPdfData(Y7(Y7({},r),{getPdfDownloadUrl:"true"})),c={pdfs:[]},t?[4,a]:[3,6];case 1:return(c=f.sent()).pdfs.length>0?(e=c.pdfs[0]._id,[3,5]):[3,2];case 2:return he((function(e){return Q7(Q7([],e,!0),[t],!1)})),[4,Z.current.insertPdfAndItsPagesInDb({pdfSourceUrl:t,pdfFileName:"sourceUrl.pdf"})];case 3:return i=f.sent(),e=i._id,[4,Z.current.fetchOnlyPdfData(Y7(Y7({},r),{getPdfDownloadUrl:"true"}))];case 4:c=f.sent(),he((function(e){return Q7([],e.filter((function(e){return e!==t})),!0)})),f.label=5;case 5:return[3,8];case 6:return[4,a];case 7:c=f.sent(),f.label=8;case 8:return l=Z.current.fetchOnlyPdfPagesData({pdfId:e,getPdfPageImageDownloadUrl:"true",pdfPageImageUploaded:"true"}),s=Z.current.fetchPdfScales({pdfId:e}),[4,l];case 9:return h=f.sent(),[4,s];case 10:return d=f.sent(),!g.measureToolRelatedData.scaleIdSelected&&d.scales.length>0&&y(Rle((function(e){var t;e.measureToolRelatedData.scaleIdSelected=(null===(t=d.scales[0])||void 0===t?void 0:t._id)||""}))),(u=null===(v=null==c?void 0:c.pdfs[0])||void 0===v?void 0:v.pdfDownloadUrl)?[4,jie(u).promise]:[3,12];case 11:return p=f.sent(),[3,13];case 12:p=null,f.label=13;case 13:return(m=p)&&o((function(n){var r,a,o=Q7([],n,!0),i=o.length>0?o.findIndex((function(t){return t._id===e})):-1,l=-1!==i,s={_id:null===(a=null===(r=null==c?void 0:c.pdfs)||void 0===r?void 0:r[0])||void 0===a?void 0:a._id,sourcePdfUrl:t||"",pdfPagesImageGenerationStatus:c.pdfs[0].pdfPagesImageGenerationStatus,pdfDownloadUrl:c.pdfs[0].pdfDownloadUrl,pdfDocument:m,pages:h.pages.map((function(e){return{_id:null==e?void 0:e._id,pdfId:e.pdfId,annotations:[],commentThreads:[],pageImageUrl:e.pageAsImageDetails.pageImageDownloadUrl||"",pageNumber:e.pageNumber,pdfPageWidthInPoints:e.pdfPageWidthInPoints,pdfPageHeightInPoints:e.pdfPageHeightInPoints,pageAsImageDetails:e.pageAsImageDetails}})),scales:d.scales.map((function(e){return Y7({},e)}))};return l?o[i]=Y7({},s):o.push(s),o})),ie(e),[2]}}))}))}),[oe,Z,ie,o]),ve=l((function(e){y((function(t){var n=Y7({},t);return n.toolsRelatedData=Y7(Y7({},n.toolsRelatedData),{comment:Y7(Y7({},n.toolsRelatedData.comment),{selectedThreadId:e})}),n}))}),[y]),fe=g.measureToolRelatedData.addNewScaleDetails,ze=g.measureToolRelatedData.editScaleDetails,ge=l((function(){return K7(t,void 0,void 0,(function(){return X7(this,(function(e){return y((function(e){var t,n;return Y7(Y7({},e),{measureToolRelatedData:Y7(Y7({},e.measureToolRelatedData),{addNewScaleDetails:Y7(Y7({},e.measureToolRelatedData.addNewScaleDetails),{isAddNewScaleFormPopupOpen:!0,pdfPageId:null===(n=null===(t=null==a?void 0:a[0])||void 0===t?void 0:t.pages[0])||void 0===n?void 0:n._id})})})})),[2]}))}))}),[a]),ye=c([]),Me=ye[0],Ee=ye[1],be=l((function(e){return K7(t,void 0,void 0,(function(){var t,n,r;return X7(this,(function(c){switch(c.label){case 0:return(t=a.find((function(t){return t._id===e.pdfIdOfPage})))&&(n=t.pages.find((function(t){return t._id===e.pdfPageId})))?n.pageImageElement||Me.includes(n._id)?[2]:(Ee((function(e){return Q7(Q7([],e,!0),[n._id],!1)})),[4,xre.downloadImage(n.pageImageUrl)]):[2];case 1:return r=c.sent(),o((function(t){var n=t.map((function(e){return Y7(Y7({},e),{pages:e.pages.map((function(e){return Y7({},e)}))})})),a=n.findIndex((function(t){return t._id===e.pdfIdOfPage})),o=n[a].pages.findIndex((function(t){return t._id===e.pdfPageId}));return n[a].pages[o].pageImageElement=r,n})),Ee((function(e){return Q7([],e.filter((function(e){return e!==n._id})),!0)})),[2]}}))}))}),[Me,a]),He=l((function(e){return K7(t,void 0,void 0,(function(){var t,n,r,c;return X7(this,(function(i){switch(i.label){case 0:return t=e.pdfId,(n=a.find((function(e){return e._id===t})))?(r=n.pages.map((function(e){return e._id})),[4,Z.current.fetchOnlyPdfPagesData({excludePdfPageIds:r,pdfId:t,getPdfPageImageDownloadUrl:"true",pdfPageImageUploaded:"true"})]):[2];case 1:return c=i.sent(),o((function(e){var n=e.findIndex((function(e){return e._id===t}));return-1===n?e:(e[n].pages=Q7(Q7([],e[n].pages,!0),c.pages.map((function(e){return{_id:e._id,pdfId:e.pdfId,pageNumber:e.pageNumber,annotations:[],commentThreads:[],pageAsImageDetails:e.pageAsImageDetails,pageImageUrl:e.pageAsImageDetails.pageImageDownloadUrl||"",pdfPageWidthInPoints:e.pdfPageWidthInPoints,pdfPageHeightInPoints:e.pdfPageHeightInPoints}})),!0),Q7([],e,!0))})),[2]}}))}))}),[a,Z]),Ve=l((function(e){var n=e.pdfId,r=e.pdfPageId,a=e.annotationIds;return K7(t,void 0,void 0,(function(){return X7(this,(function(e){return o((function(e){return e.map((function(e){return e._id===n?Y7(Y7({},e),{pages:e.pages.map((function(e){return e._id===r?Y7(Y7({},e),{annotations:e.annotations.filter((function(e){return!a.includes(e._id)||(Z.current.deletePageAnnotation({annotationId:e._id}),!1)}))}):Y7({},e)}))}):Y7({},e)}))})),[2]}))}))}),[Z]),Ce=l((function(e){var t=e.pdfId,n=e.pdfPageId,r=e.annotations;o((function(e){return e.map((function(e){return e._id===t?Y7(Y7({},e),{pages:e.pages.map((function(e){return e._id===n?Y7(Y7({},e),{annotations:Q7(Q7([],e.annotations,!0),r,!0)}):Y7({pdfPageId:e._id},e)}))}):Y7({},e)}))}))}),[]),Le=c({rectangleAnnotationOptions:X,rectangleAnnotationData:{_id:"",color:"",height:0,width:0,pdfId:"",pdfPageId:"",rotationAngle:0,x:0,y:0},rectangleAnnotationConfigurationDrawer:{isOpen:!1,sections:{color:{collapsedStatus:"collapsed",currentlySelectedColor:""}}}}),ke=Le[0],we=Le[1],Se=h((function(){for(var e=null,t=0,n=a||[];t<n.length;t++)for(var r=0,o=n[t].pages||[];r<o.length;r++)for(var c=0,i=o[r].annotations||[];c<i.length;c++){var l=i[c];if(l._id===u)return l}return e}),[u]);s((function(){(null==Se?void 0:Se.rectangleAnnotation)?we(Rle((function(e){var t;e.rectangleAnnotationConfigurationDrawer.sections.color.currentlySelectedColor=(null===(t=Se.rectangleAnnotation)||void 0===t?void 0:t.color)||""}))):(y(Rle((function(e){e.measureToolRelatedData.distanceAnnotation.configurationsDrawer.isOpen=!1}))),we(Rle((function(e){e.rectangleAnnotationConfigurationDrawer.isOpen=!1}))))}),[Se]);var xe=h((function(){return{pdfs:a,setPdfs:o,annotationSelectedId:u,setAnnotationSelectedId:m,toolSelected:v,setToolSelected:f,tools:g,setTools:y,currentUserId:E,setCurrentUserId:b,users:V,setUsers:C,isLeftBarOpen:_,setIsLeftBarOpen:D,isAnnotationsVisible:j,setIsAnnotationsVisible:U,backendBaseUrl:Q,fetchPdfRelatedData:pe,removeAnnotationsFromPdfPageAndDb:Ve,addAnnotationsToPdfPage:Ce,addPdfPageImageElementIfNotPresentAlready:be,setSelectedCommentThreadId:ve,pageZoomPercentage:A,setPageZoomPercentage:R,rlefEventServiceBaseUrl:J,addNewScaleDetails:fe,addScaleButtonClickedFromToolbar:ge,pdfEditorServiceRef:Z,fetchAndSetPdfPagesInPdfWhichAreCreatedInDB:He,pdfPageIdsForWhichPageImageElementIsBeingFetched:Me,callOutToolRelatedDataWhenSelected:ue,setCallOutToolRelatedDataWhenSelected:me,pdfEditorElementId:te,selectedToolGroup:$,setSelectedToolGroup:q,pdfIdsWhoseDataBeingFetched:re,annotationSelected:Se,editScaleDetails:ze,suggestedUsersForMention:k,fetchAndSetSuggestedUsersForMention:ce,isFetchingSuggestedUsersForMention:x,customCursorToShow:Y,setCustomCursorToShow:K,rectangleRelatedData:ke,setRectangleRelatedData:we}}),[a,u,v,g,E,V,_,j,Q,pe,be,ve,A,R,J,fe,ge,He,Me,ue,te,$,re,Se,ze,k,ce,x,Y,ke]);return n(Ule.Provider,Y7({value:xe},{children:e.children}))}var Ule=a.createContext({}),Wle=function(){var e=a.useContext(Ule);if(!e)throw new Error("usePdfAnnotationContext must be used within a PdfEditorContextProvider");return e};Uie(".ContentArea-module_content-area-container__otXm-{align-items:center;background-color:#e3e6e8;display:flex;flex:1;justify-content:center;overflow:auto;position:relative}");Uie(".PdfPage-module_pageContainer__-Q0sD{display:flex;flex-grow:1;height:100%;width:100%}.PdfPage-module_pageContainerWhenHorizontallyOverflowingAndIsVisibleInViewport__8onR1{align-self:flex-start}.PdfPage-module_justifyContentCenter__-7ATB{justify-content:center}.PdfPage-module_selectedText__m7jFl span::selection{background-color:#ffff0045!important}.PdfPage-module_selectedText__m7jFl span::-moz-selection{background-color:#ffff0045!important}.PdfPage-module_displayNone__cHRJo{display:none}.PdfPage-module_handCursor__vsE7b{cursor:grab!important}.PdfPage-module_handCursor__vsE7b:active{cursor:grabbing!important}");var $le=Math.PI/180;const qle=void 0!==J7?J7:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},Gle={_global:qle,version:"8.4.3",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>Gle.angleDeg?e*$le:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>Gle.DD.isDragging,isDragReady:()=>!!Gle.DD.node,releaseCanvasOnDestroy:!0,document:qle.document,_injectGlobal(e){qle.Konva=e}},Yle=e=>{Gle[e.prototype.getClassName()]=e};Gle._injectGlobal(Gle);class Kle{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Kle(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){var t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,a=this.m[1]*t+this.m[3]*n,o=this.m[0]*-n+this.m[2]*t,c=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=a,this.m[2]=o,this.m[3]=c,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,a=this.m[2]+this.m[0]*e,o=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=a,this.m[3]=o,this}multiply(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],o=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],c=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=a,this.m[4]=o,this.m[5]=c,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,a=this.m[0]*e,o=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),c=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=a,this.m[4]=o,this.m[5]=c,this}getMatrix(){return this.m}decompose(){var e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],a=e*r-t*n;let o={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var c=Math.sqrt(e*e+t*t);o.rotation=t>0?Math.acos(e/c):-Math.acos(e/c),o.scaleX=c,o.scaleY=a/c,o.skewX=(e*n+t*r)/a,o.skewY=0}else if(0!=n||0!=r){var i=Math.sqrt(n*n+r*r);o.rotation=Math.PI/2-(r>0?Math.acos(-n/i):-Math.acos(n/i)),o.scaleX=a/i,o.scaleY=i,o.skewX=0,o.skewY=(e*n+t*r)/a}return o.rotation=rse._getRotation(o.rotation),o}}var Xle=Math.PI/180,Qle=180/Math.PI,Jle="Konva error: ",Zle={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},ese=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,tse=[];const nse="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)},rse={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){tse.push(e),1===tse.length&&nse((function(){const e=tse;tse=[],e.forEach((function(e){e()}))}))},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(e){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var n=rse.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex:(e,t,n)=>((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()|0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB(e){var t;return e in Zle?{r:(t=Zle[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=ese.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",rse._namedColorToRBA(e)||rse._hex3ColorToRGBA(e)||rse._hex4ColorToRGBA(e)||rse._hex6ColorToRGBA(e)||rse._hex8ColorToRGBA(e)||rse._rgbColorToRGBA(e)||rse._rgbaColorToRGBA(e)||rse._hslColorToRGBA(e)),_namedColorToRBA(e){var t=Zle[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e)));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if("#"===e[0]&&9===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if("#"===e[0]&&5===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,a=Number(n[1])/100,o=Number(n[2])/100;let c,i,l;if(0===a)return l=255*o,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};c=o<.5?o*(1+a):o+a-o*a;const s=2*o-c,h=[0,0,0];for(let e=0;e<3;e++)i=r+1/3*-(e-1),i<0&&i++,i>1&&i--,l=6*i<1?s+6*(c-s)*i:2*i<1?c:3*i<2?s+(c-s)*(2/3-i)*6:s,h[e]=255*l;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y),cloneObject(e){var t={};for(var n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray:e=>e.slice(0),degToRad:e=>e*Xle,radToDeg:e=>e*Qle,_degToRad:e=>(rse.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),rse.degToRad(e)),_radToDeg:e=>(rse.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),rse.radToDeg(e)),_getRotation:e=>Gle.angleDeg?rse.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(Jle+e)},error(e){console.error(Jle+e)},warn(e){Gle.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(var n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e<n,_getProjectionToSegment(e,t,n,r,a,o){var c,i,l,s=(e-n)*(e-n)+(t-r)*(t-r);if(0==s)c=e,i=t,l=(a-n)*(a-n)+(o-r)*(o-r);else{var h=((a-e)*(n-e)+(o-t)*(r-t))/s;h<0?(c=e,i=t,l=(e-a)*(e-a)+(t-o)*(t-o)):h>1?(c=n,i=r,l=(n-a)*(n-a)+(r-o)*(r-o)):l=((c=e+h*(n-e))-a)*(c-a)+((i=t+h*(r-t))-o)*(i-o)}return[c,i,l]},_getProjectionToLine(e,t,n){var r=rse.cloneObject(e),a=Number.MAX_VALUE;return t.forEach((function(o,c){if(n||c!==t.length-1){var i=t[(c+1)%t.length],l=rse._getProjectionToSegment(o.x,o.y,i.x,i.y,e.x,e.y),s=l[0],h=l[1],d=l[2];d<a&&(r.x=s,r.y=h,a=d)}})),r},_prepareArrayForTween(e,t,n){var r,a=[],o=[];if(e.length>t.length){var c=t;t=e,e=c}for(r=0;r<e.length;r+=2)a.push({x:e[r],y:e[r+1]});for(r=0;r<t.length;r+=2)o.push({x:t[r],y:t[r+1]});var i=[];return o.forEach((function(e){var t=rse._getProjectionToLine(e,a,n);i.push(t.x),i.push(t.y)})),i},_prepareToStringify(e){var t;for(var n in e.visitedByCircularReferenceRemoval=!0,e)if(e.hasOwnProperty(n)&&e[n]&&"object"==typeof e[n])if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||rse._isElement(e[n])){if(!t.configurable)return null;delete e[n]}else if(null===rse._prepareToStringify(e[n])){if(!t.configurable)return null;delete e[n]}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(var n in t)e[n]=t[n];return e},_getFirstPointerId:e=>e.touches?e.changedTouches[0].identifier:e.pointerId||999,releaseCanvas(...e){Gle.releaseCanvasOnDestroy&&e.forEach((e=>{e.width=0,e.height=0}))},drawRoundedRectPath(e,t,n,r){let a=0,o=0,c=0,i=0;"number"==typeof r?a=o=c=i=Math.min(r,t/2,n/2):(a=Math.min(r[0]||0,t/2,n/2),o=Math.min(r[1]||0,t/2,n/2),i=Math.min(r[2]||0,t/2,n/2),c=Math.min(r[3]||0,t/2,n/2)),e.moveTo(a,0),e.lineTo(t-o,0),e.arc(t-o,o,o,3*Math.PI/2,0,!1),e.lineTo(t,n-i),e.arc(t-i,n-i,i,0,Math.PI/2,!1),e.lineTo(c,n),e.arc(c,n-c,c,Math.PI/2,Math.PI,!1),e.lineTo(0,a),e.arc(a,a,a,Math.PI,3*Math.PI/2,!1)}};function ase(e){return rse._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||rse._isBoolean(e)?e:Object.prototype.toString.call(e)}function ose(e){return e>255?255:e<0?0:Math.round(e)}function cse(){if(Gle.isUnminified)return function(e,t){return rse._isNumber(e)||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function ise(e){if(Gle.isUnminified)return function(t,n){let r=rse._isNumber(t),a=rse._isArray(t)&&t.length==e;return r||a||rse.warn(ase(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function lse(){if(Gle.isUnminified)return function(e,t){return rse._isNumber(e)||"auto"===e||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function sse(){if(Gle.isUnminified)return function(e,t){return rse._isString(e)||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function hse(){if(Gle.isUnminified)return function(e,t){const n=rse._isString(e),r="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||r||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function dse(){if(Gle.isUnminified)return function(e,t){return!0===e||!1===e||rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}var use="get",mse="set";const pse={addGetterSetter(e,t,n,r,a){pse.addGetter(e,t,n),pse.addSetter(e,t,r,a),pse.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){var r=use+rse._capitalize(t);e.prototype[r]=e.prototype[r]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter(e,t,n,r){var a=mse+rse._capitalize(t);e.prototype[a]||pse.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){var a=mse+rse._capitalize(t);e.prototype[a]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,a){var o,c,i=n.length,l=rse._capitalize,s=use+l(t),h=mse+l(t);e.prototype[s]=function(){var e={};for(o=0;o<i;o++)e[c=n[o]]=this.getAttr(t+l(c));return e};var d=function(e){if(Gle.isUnminified)return function(t,n){return null==t||rse.isObject(t)||rse.warn(ase(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}(n);e.prototype[h]=function(e){var o,c=this.attrs[t];for(o in r&&(e=r.call(this,e)),d&&d.call(this,e,t),e)e.hasOwnProperty(o)&&this._setAttr(t+l(o),e[o]);return e||n.forEach((e=>{this._setAttr(t+l(e),void 0)})),this._fireChangeEvent(t,c,e),a&&a.call(this),this},pse.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){var n=rse._capitalize(t),r=mse+n,a=use+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[a]()}},addDeprecatedGetterSetter(e,t,n,r){rse.error("Adding deprecated "+t);var a=use+rse._capitalize(t),o=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[a]=function(){rse.error(o);var e=this.attrs[t];return void 0===e?n:e},pse.addSetter(e,t,r,(function(){rse.error(o)})),pse.addOverloadedGetterSetter(e,t)},backCompat(e,t){rse.each(t,(function(t,n){var r=e.prototype[n],a=use+rse._capitalize(t),o=mse+rse._capitalize(t);function c(){r.apply(this,arguments),rse.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=c,e.prototype[a]=c,e.prototype[o]=c}))},afterSetFilter(){this._filterUpToDate=!1}};var vse,fse=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class zse{constructor(e){this.canvas=e,Gle.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){var n,r,a,o,c=this.traceArr,i=c.length,l="";for(n=0;n<i;n++)(a=(r=c[n]).method)?(o=r.args,l+=a,e?l+="()":rse._isArray(o[0])?l+="(["+o.join(",")+"])":(t&&(o=o.map((e=>"number"==typeof e?Math.floor(e):e))),l+="("+o.join(",")+")")):(l+=r.property,e||(l+="="+r.val)),l+=";";return l}clearTrace(){this.traceArr=[]}_trace(e){var t=this.traceArr;t.push(e),t.length>=100&&t.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,a,o){this._context.arc(e,t,n,r,a,o)}arcTo(e,t,n,r,a){this._context.arcTo(e,t,n,r,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,a,o){this._context.bezierCurveTo(e,t,n,r,a,o)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,a,o){return this._context.createRadialGradient(e,t,n,r,a,o)}drawImage(e,t,n,r,a,o,c,i,l){var s=arguments,h=this._context;3===s.length?h.drawImage(e,t,n):5===s.length?h.drawImage(e,t,n,r,a):9===s.length&&h.drawImage(e,t,n,r,a,o,c,i,l)}ellipse(e,t,n,r,a,o,c,i){this._context.ellipse(e,t,n,r,a,o,c,i)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,a,o){this._context.setTransform(e,t,n,r,a,o)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,a,o){this._context.transform(e,t,n,r,a,o)}translate(e,t){this._context.translate(e,t)}_enableTrace(){var e,t,n=this,r=fse.length,a=this.setAttr,o=function(e){var r,a=n[e];n[e]=function(){return t=function(e){var t,n,r=[],a=e.length,o=rse;for(t=0;t<a;t++)n=e[t],o._isNumber(n)?n=Math.round(1e3*n)/1e3:o._isString(n)||(n+=""),r.push(n);return r}(Array.prototype.slice.call(arguments,0)),r=a.apply(n,arguments),n._trace({method:e,args:t}),r}};for(e=0;e<r;e++)o(fse[e]);n.setAttr=function(){a.apply(n,arguments);var e=arguments[0],t=arguments[1];"shadowOffsetX"!==e&&"shadowOffsetY"!==e&&"shadowBlur"!==e||(t/=this.canvas.getPixelRatio()),n._trace({property:e,val:t})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||"source-over"===t||this.setAttr("globalCompositeOperation",t)}}["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach((function(e){Object.defineProperty(zse.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})}));class gse extends zse{constructor(e){super(e),this._context=e._canvas.getContext("2d")}_fillColor(e){var t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){const t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){const t=e.fill(),n=e.getFillPriority();if(t&&"color"===n)return void this._fillColor(e);const r=e.getFillPatternImage();if(r&&"pattern"===n)return void this._fillPattern(e);const a=e.getFillLinearGradientColorStops();if(a&&"linear-gradient"===n)return void this._fillLinearGradient(e);const o=e.getFillRadialGradientColorStops();o&&"radial-gradient"===n?this._fillRadialGradient(e):t?this._fillColor(e):r?this._fillPattern(e):a?this._fillLinearGradient(e):o&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(var o=0;o<r.length;o+=2)a.addColorStop(r[o],r[o+1]);this.setAttr("strokeStyle",a)}}_stroke(e){var t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r,a=null!==(t=e.getShadowRGBA())&&void 0!==t?t:"black",o=null!==(n=e.getShadowBlur())&&void 0!==n?n:5,c=null!==(r=e.getShadowOffset())&&void 0!==r?r:{x:0,y:0},i=e.getAbsoluteScale(),l=this.canvas.getPixelRatio(),s=i.x*l,h=i.y*l;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",o*Math.min(Math.abs(s),Math.abs(h))),this.setAttr("shadowOffsetX",c.x*s),this.setAttr("shadowOffsetY",c.y*h)}}class yse extends zse{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const a=e.getStrokeScaleEnabled();if(!a){this.save();var t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(e);var n=e.hitStrokeWidth(),r="auto"===n?e.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),a||this.restore()}}}class Mse{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var t=(e||{}).pixelRatio||Gle.pixelRatio||function(){if(vse)return vse;var e=rse.createCanvasElement(),t=e.getContext("2d");return vse=(Gle._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),rse.releaseCanvas(e),vse}();this.pixelRatio=t,this._canvas=rse.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){var t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";var t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch(e){try{return this._canvas.toDataURL()}catch(e){return rse.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}pse.addGetterSetter(Mse,"pixelRatio",void 0,cse());class Ese extends Mse{constructor(e={width:0,height:0}){super(e),this.context=new gse(this),this.setSize(e.width,e.height)}}class bse extends Mse{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new yse(this),this.setSize(e.width,e.height)}}const Hse={get isDragging(){var e=!1;return Hse._dragElements.forEach((t=>{"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){var e;return Hse._dragElements.forEach((t=>{e=t.node})),e},_dragElements:new Map,_drag(e){const t=[];Hse._dragElements.forEach(((n,r)=>{const{node:a}=n,o=a.getStage();o.setPointersPositions(e),void 0===n.pointerId&&(n.pointerId=rse._getFirstPointerId(e));const c=o._changedPointerPositions.find((e=>e.id===n.pointerId));if(c){if("dragging"!==n.dragStatus){var i=a.dragDistance();if(Math.max(Math.abs(c.x-n.startPointerPos.x),Math.abs(c.y-n.startPointerPos.y))<i)return;if(a.startDrag({evt:e}),!a.isDragging())return}a._setDragPosition(e,n),t.push(a)}})),t.forEach((t=>{t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)}))},_endDragBefore(e){const t=[];Hse._dragElements.forEach((n=>{const{node:r}=n,a=r.getStage();if(e&&a.setPointersPositions(e),!a._changedPointerPositions.find((e=>e.id===n.pointerId)))return;"dragging"!==n.dragStatus&&"stopped"!==n.dragStatus||(Hse.justDragged=!0,Gle._mouseListenClick=!1,Gle._touchListenClick=!1,Gle._pointerListenClick=!1,n.dragStatus="stopped");const o=n.node.getLayer()||n.node instanceof Gle.Stage&&n.node;o&&-1===t.indexOf(o)&&t.push(o)})),t.forEach((e=>{e.draw()}))},_endDragAfter(e){Hse._dragElements.forEach(((t,n)=>{"stopped"===t.dragStatus&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),"dragging"!==t.dragStatus&&Hse._dragElements.delete(n)}))}};Gle.isBrowser&&(window.addEventListener("mouseup",Hse._endDragBefore,!0),window.addEventListener("touchend",Hse._endDragBefore,!0),window.addEventListener("mousemove",Hse._drag),window.addEventListener("touchmove",Hse._drag),window.addEventListener("mouseup",Hse._endDragAfter,!1),window.addEventListener("touchend",Hse._endDragAfter,!1));var Vse="absoluteOpacity",Cse="allEventListeners",Lse="absoluteTransform",kse="absoluteScale",wse="canvas",Sse="listening",xse="mouseenter",Tse="mouseleave",Ose="Shape",Ase=" ",Rse="stage",Nse="transform",_se="visible",Dse=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Ase);let Pse=1;class Fse{constructor(e){this._id=Pse++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){e!==Nse&&e!==Lse||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){var n=this._cache.get(e);return(void 0===n||(e===Nse||e===Lse)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map((e=>e+"Change.konva")).join(Ase);this.on(n,(()=>{this._clearCache(e)})),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(wse)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Lse&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(wse)){const{scene:e,filter:t,hit:n}=this._cache.get(wse);rse.releaseCanvas(e,t,n),this._cache.delete(wse)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var t=e||{},n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var r=Math.ceil(t.width||n.width),a=Math.ceil(t.height||n.height),o=t.pixelRatio,c=void 0===t.x?Math.floor(n.x):t.x,i=void 0===t.y?Math.floor(n.y):t.y,l=t.offset||0,s=t.drawBorder||!1,h=t.hitCanvasPixelRatio||1;if(r&&a){c-=l,i-=l;var d=new Ese({pixelRatio:o,width:r+=2*l+1,height:a+=2*l+1}),u=new Ese({pixelRatio:o,width:0,height:0}),m=new bse({pixelRatio:h,width:r,height:a}),p=d.getContext(),v=m.getContext();return m.isCache=!0,d.isCache=!0,this._cache.delete(wse),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(d.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),p.save(),v.save(),p.translate(-c,-i),v.translate(-c,-i),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Vse),this._clearSelfAndDescendantCache(kse),this.drawScene(d,this),this.drawHit(m,this),this._isUnderCache=!1,p.restore(),v.restore(),s&&(p.save(),p.beginPath(),p.rect(0,0,r,a),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(wse,{scene:d,filter:u,hit:m,x:c,y:i}),this._requestDraw(),this}rse.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(wse)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){var n,r,a,o,c=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],i=this.getAbsoluteTransform(t);return c.forEach((function(e){var t=i.point(e);void 0===n&&(n=a=t.x,r=o=t.y),n=Math.min(n,t.x),r=Math.min(r,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y)})),{x:n,y:r,width:a-n,height:o-r}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);var n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){var t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e,t,n,r,a=this.filters(),o=this._getCanvasCache(),c=o.scene,i=o.filter,l=i.getContext();if(a){if(!this._filterUpToDate){var s=c.pixelRatio;i.setSize(c.width/c.pixelRatio,c.height/c.pixelRatio);try{for(e=a.length,l.clear(),l.drawImage(c._canvas,0,0,c.getWidth()/s,c.getHeight()/s),t=l.getImageData(0,0,i.getWidth(),i.getHeight()),n=0;n<e;n++)"function"==typeof(r=a[n])?(r.call(this,t),l.putImageData(t,0,0)):rse.error("Filter should be type of function, but got "+typeof r+" instead. Please check correct filters")}catch(e){rse.error("Unable to apply filter. "+e.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return i}return c}on(e,t){if(this._cache&&this._cache.delete(Cse),3===arguments.length)return this._delegate.apply(this,arguments);var n,r,a,o,c=e.split(Ase),i=c.length;for(n=0;n<i;n++)a=(r=c[n].split("."))[0],o=r[1]||"",this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:o,handler:t});return this}off(e,t){var n,r,a,o,c,i=(e||"").split(Ase),l=i.length;if(this._cache&&this._cache.delete(Cse),!e)for(r in this.eventListeners)this._off(r);for(n=0;n<l;n++)if(o=(a=i[n].split("."))[0],c=a[1],o)this.eventListeners[o]&&this._off(o,c,t);else for(r in this.eventListeners)this._off(r,c,t);return this}dispatchEvent(e){var t={target:this,type:e.type,evt:e};return this.fire(e.type,t),this}addEventListener(e,t){return this.on(e,(function(e){t.call(this,e.evt)})),this}removeEventListener(e){return this.off(e),this}_delegate(e,t,n){var r=this;this.on(e,(function(e){for(var a=e.target.findAncestors(t,!0,r),o=0;o<a.length;o++)(e=rse.cloneObject(e)).currentTarget=a[o],n.call(a[o],e)}))}remove(){return this.isDragging()&&this.stopDrag(),Hse._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Lse),this._clearSelfAndDescendantCache(Vse),this._clearSelfAndDescendantCache(kse),this._clearSelfAndDescendantCache(Rse),this._clearSelfAndDescendantCache(_se),this._clearSelfAndDescendantCache(Sse)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){var t="get"+rse._capitalize(e);return rse._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),t=[];e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges((()=>{var t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+rse._capitalize(t),rse._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))})),this}isListening(){return this._getCache(Sse,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(_se,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),r=!1;Hse._dragElements.forEach((e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(r=!0)}));var a=!t&&!Gle.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e,t,n,r,a=this.getDepth(),o=this,c=0;return"Stage"!==o.nodeType&&function i(l){for(e=[],t=l.length,n=0;n<t;n++)r=l[n],c++,r.nodeType!==Ose&&(e=e.concat(r.getChildren().slice())),r._id===o._id&&(n=t);e.length>0&&e[0].getDepth()<=a&&i(e)}(o.getStage().getChildren()),c}getDepth(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Nse),this._clearSelfAndDescendantCache(Lse)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges((()=>{this.x(e.x),this.y(e.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(e)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var r=this.getAbsoluteTransform(e).getMatrix(),a=new Kle,o=this.offset();return a.m=r.slice(),a.translate(o.x,o.y),a.getTranslation()}setAbsolutePosition(e){var t=this._clearTransform();this.attrs.x=t.x,this.attrs.y=t.y,delete t.x,delete t.y,this._clearCache(Nse);var n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(e.x,e.y),e={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(t),this.setPosition({x:e.x,y:e.y}),this._clearCache(Nse),this._clearSelfAndDescendantCache(Lse),this}_setTransform(e){var t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var t=e.x,n=e.y,r=this.x(),a=this.y();return void 0!==t&&(r+=t),void 0!==n&&(a+=n),this.setPosition({x:r,y:a}),this}_eachAncestorReverse(e,t){var n,r,a=[],o=this.getParent();if(!t||t._id!==this._id){for(a.unshift(this);o&&(!t||o._id!==t._id);)a.unshift(o),o=o.parent;for(n=a.length,r=0;r<n;r++)e(a[r])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return rse.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return rse.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return rse.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return rse.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return rse.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&rse.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Vse,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e,t,n,r,a={},o=this.getAttrs();for(e in a.attrs={},o)t=o[e],rse.isObject(t)&&!rse._isPlainObject(t)&&!rse._isArray(t)||(n="function"==typeof this[e]&&this[e],delete o[e],r=n?n.call(this):null,o[e]=t,r!==t&&(a.attrs[e]=t));return a.className=this.getClassName(),rse._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){var r=[];t&&this._isMatch(e)&&r.push(this);for(var a=this.parent;a;){if(a===n)return r;a._isMatch(e)&&r.push(a),a=a.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var t,n,r=e.replace(/ /g,"").split(","),a=r.length;for(t=0;t<a;t++)if(n=r[t],rse.isValidSelector(n)||(rse.warn('Selector "'+n+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),rse.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),rse.warn("Konva is awesome, right?")),"#"===n.charAt(0)){if(this.id()===n.slice(1))return!0}else if("."===n.charAt(0)){if(this.hasName(n.slice(1)))return!0}else if(this.className===n||this.nodeType===n)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(Rse,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():void 0}fire(e,t={},n){return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Lse,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var t;if(e)return t=new Kle,this._eachAncestorReverse((function(e){var n=e.transformsEnabled();"all"===n?t.multiply(e.getTransform()):"position"===n&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())}),e),t;t=this._cache.get(Lse)||new Kle,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();var n=this.transformsEnabled();if("all"===n)t.multiply(this.getTransform());else if("position"===n){const e=this.attrs.x||0,n=this.attrs.y||0,r=this.attrs.offsetX||0,a=this.attrs.offsetY||0;t.translate(e-r,n-a)}return t.dirty=!1,t}getAbsoluteScale(e){for(var t=this;t;)t._isUnderCache&&(e=t),t=t.getParent();const n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Nse,this._getTransform)}_getTransform(){var e,t,n=this._cache.get(Nse)||new Kle;n.reset();var r=this.x(),a=this.y(),o=Gle.getAngle(this.rotation()),c=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,i=null!==(t=this.attrs.scaleY)&&void 0!==t?t:1,l=this.attrs.skewX||0,s=this.attrs.skewY||0,h=this.attrs.offsetX||0,d=this.attrs.offsetY||0;return 0===r&&0===a||n.translate(r,a),0!==o&&n.rotate(o),0===l&&0===s||n.skew(l,s),1===c&&1===i||n.scale(c,i),0===h&&0===d||n.translate(-1*h,-1*d),n.dirty=!1,n}clone(e){var t,n,r,a,o,c=rse.cloneObject(this.attrs);for(t in e)c[t]=e[t];var i=new this.constructor(c);for(t in this.eventListeners)for(r=(n=this.eventListeners[t]).length,a=0;a<r;a++)(o=n[a]).name.indexOf("konva")<0&&(i.eventListeners[t]||(i.eventListeners[t]=[]),i.eventListeners[t].push(o));return i}_toKonvaCanvas(e){e=e||{};var t=this.getClientRect(),n=this.getStage(),r=void 0!==e.x?e.x:Math.floor(t.x),a=void 0!==e.y?e.y:Math.floor(t.y),o=e.pixelRatio||1,c=new Ese({width:e.width||Math.ceil(t.width)||(n?n.width():0),height:e.height||Math.ceil(t.height)||(n?n.height():0),pixelRatio:o}),i=c.getContext();return!1===e.imageSmoothingEnabled&&(i._context.imageSmoothingEnabled=!1),i.save(),(r||a)&&i.translate(-1*r,-1*a),this.drawScene(c),i.restore(),c}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){var t=(e=e||{}).mimeType||null,n=e.quality||null,r=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(r),r}toImage(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,rse._urlToImage(this.toDataURL(e),(function(e){t(e),null==n||n(e)}))}catch(e){n(e)}}))}toBlob(e){return new Promise(((t,n)=>{try{const n=null==e?void 0:e.callback;n&&delete e.callback,this.toCanvas(e).toBlob((e=>{t(e),null==n||n(e)}))}catch(e){n(e)}}))}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Gle.dragDistance}_off(e,t,n){var r,a,o,c=this.eventListeners[e];for(r=0;r<c.length;r++)if(a=c[r].name,o=c[r].handler,!("konva"===a&&"konva"!==t||t&&a!==t||n&&n!==o)){if(c.splice(r,1),0===c.length){delete this.eventListeners[e];break}r--}}_fireChangeEvent(e,t,n){this._fire(e+"Change",{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){var t=this.name(),n=t?t+" "+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;const t=this.name();return!!t&&-1!==(t||"").split(/\s/g).indexOf(e)}removeName(e){var t=(this.name()||"").split(/\s/g),n=t.indexOf(e);return-1!==n&&(t.splice(n,1),this.name(t.join(" "))),this}setAttr(e,t){var n=this["set"+rse._capitalize(e)];return rse._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){if(Gle.autoDrawEnabled){const e=this.getLayer()||this.getStage();null==e||e.batchDraw()}}_setAttr(e,t){var n=this.attrs[e];(n!==t||rse.isObject(t))&&(null==t?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){var r;void 0!==n&&((r=this.attrs[e])||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,r,n))}_fireAndBubble(e,t,n){if(t&&this.nodeType===Ose&&(t.target=this),e!==xse&&e!==Tse||!(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||"Stage"===this.nodeType&&!n)){this._fire(e,t);var r=(e===xse||e===Tse)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(t&&!t.cancelBubble||!t)&&this.parent&&this.parent.isListening()&&!r&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,t,n):this._fireAndBubble.call(this.parent,e,t))}}_getProtoListeners(e){let t=this._cache.get(Cse);if(!t){t={};let e=Object.getPrototypeOf(this);for(;e;)if(e.eventListeners){for(var n in e.eventListeners){const r=e.eventListeners[n],a=t[n]||[];t[n]=r.concat(a)}e=Object.getPrototypeOf(e)}else e=Object.getPrototypeOf(e);this._cache.set(Cse,t)}return t[e]}_fire(e,t){(t=t||{}).currentTarget=this,t.type=e;const n=this._getProtoListeners(e);if(n)for(var r=0;r<n.length;r++)n[r].handler.call(this,t);const a=this.eventListeners[e];if(a)for(r=0;r<a.length;r++)a[r].handler.call(this,t)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var t=e?e.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition(),a=n._getPointerById(t)||n._changedPointerPositions[0]||r;Hse._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-r.x,y:a.y-r.y},dragStatus:"ready",pointerId:t})}startDrag(e,t=!0){Hse._dragElements.has(this._id)||this._createDragElement(e),Hse._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},t)}_setDragPosition(e,t){const n=this.getStage()._getPointerById(t.pointerId);if(n){var r={x:n.x-t.offset.x,y:n.y-t.offset.y},a=this.dragBoundFunc();if(void 0!==a){const t=a.call(this,r,e);t?r=t:rse.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(e){const t=Hse._dragElements.get(this._id);t&&(t.dragStatus="stopped"),Hse._endDragBefore(e),Hse._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=Hse._dragElements.get(this._id);return!!e&&"dragging"===e.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(e){if((void 0===e.evt.button||Gle.dragButtons.indexOf(e.evt.button)>=0)&&!this.isDragging()){var t=!1;Hse._dragElements.forEach((e=>{this.isAncestorOf(e.node)&&(t=!0)})),t||this._createDragElement(e)}}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const e=Hse._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&Hse._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return rse.haveIntersection(n,this.getClientRect())}static create(e,t){return rse._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){var n,r,a,o=Fse.prototype.getClassName.call(e),c=e.children;if(t&&(e.attrs.container=t),Gle[o]||(rse.warn('Can not find a node with class name "'+o+'". Fallback to "Shape".'),o="Shape"),n=new Gle[o](e.attrs),c)for(r=c.length,a=0;a<r;a++)n.add(Fse._createNode(c[a]));return n}}Fse.prototype.nodeType="Node",Fse.prototype._attrsAffectingSize=[],Fse.prototype.eventListeners={},Fse.prototype.on.call(Fse.prototype,Dse,(function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(Nse),this._clearSelfAndDescendantCache(Lse))})),Fse.prototype.on.call(Fse.prototype,"visibleChange.konva",(function(){this._clearSelfAndDescendantCache(_se)})),Fse.prototype.on.call(Fse.prototype,"listeningChange.konva",(function(){this._clearSelfAndDescendantCache(Sse)})),Fse.prototype.on.call(Fse.prototype,"opacityChange.konva",(function(){this._clearSelfAndDescendantCache(Vse)}));const Ise=pse.addGetterSetter;Ise(Fse,"zIndex"),Ise(Fse,"absolutePosition"),Ise(Fse,"position"),Ise(Fse,"x",0,cse()),Ise(Fse,"y",0,cse()),Ise(Fse,"globalCompositeOperation","source-over",sse()),Ise(Fse,"opacity",1,cse()),Ise(Fse,"name","",sse()),Ise(Fse,"id","",sse()),Ise(Fse,"rotation",0,cse()),pse.addComponentsGetterSetter(Fse,"scale",["x","y"]),Ise(Fse,"scaleX",1,cse()),Ise(Fse,"scaleY",1,cse()),pse.addComponentsGetterSetter(Fse,"skew",["x","y"]),Ise(Fse,"skewX",0,cse()),Ise(Fse,"skewY",0,cse()),pse.addComponentsGetterSetter(Fse,"offset",["x","y"]),Ise(Fse,"offsetX",0,cse()),Ise(Fse,"offsetY",0,cse()),Ise(Fse,"dragDistance",null,cse()),Ise(Fse,"width",0,cse()),Ise(Fse,"height",0,cse()),Ise(Fse,"listening",!0,dse()),Ise(Fse,"preventDefault",!0,dse()),Ise(Fse,"filters",null,(function(e){return this._filterUpToDate=!1,e})),Ise(Fse,"visible",!0,dse()),Ise(Fse,"transformsEnabled","all",sse()),Ise(Fse,"size"),Ise(Fse,"dragBoundFunc"),Ise(Fse,"draggable",!1,dse()),pse.backCompat(Fse,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Bse extends Fse{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const t=this.children||[];var n=[];return t.forEach((function(t){e(t)&&n.push(t)})),n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((e=>{e.parent=null,e.index=0,e.destroy()})),this.children=[],this._requestDraw(),this}add(...e){if(0===e.length)return this;if(e.length>1){for(var t=0;t<e.length;t++)this.add(e[t]);return this}const n=e[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){var n=[];return this._descendants((r=>{const a=r._isMatch(e);return a&&n.push(r),!(!a||!t)})),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){var e=Fse.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((t=>{e.children.push(t.toObject())})),e}isAncestorOf(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){var t=Fse.prototype.clone.call(this,e);return this.getChildren().forEach((function(e){t.add(e.clone())})),t}getAllIntersections(e){var t=[];return this.find("Shape").forEach((function(n){n.isVisible()&&n.intersects(e)&&t.push(n)})),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach((function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach((function(e,t){e.index=t})),this._requestDraw()}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas(),a=r&&r.getContext(),o=this._getCanvasCache(),c=o&&o.scene,i=r&&r.isCache;if(!this.isVisible()&&!i)return this;if(c){a.save();var l=this.getAbsoluteTransform(t).getMatrix();a.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",r,t);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),r=e||n&&n.hitCanvas,a=r&&r.getContext(),o=this._getCanvasCache();if(o&&o.hit){a.save();var c=this.getAbsoluteTransform(t).getMatrix();a.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n){var r,a=t&&t.getContext(),o=this.clipWidth(),c=this.clipHeight(),i=this.clipFunc(),l=o&&c||i;const s=n===this;if(l){a.save();var h=this.getAbsoluteTransform(n),d=h.getMatrix();if(a.transform(d[0],d[1],d[2],d[3],d[4],d[5]),a.beginPath(),i)i.call(this,a,this);else{var u=this.clipX(),m=this.clipY();a.rect(u,m,o,c)}a.clip(),d=h.copy().invert().getMatrix(),a.transform(d[0],d[1],d[2],d[3],d[4],d[5])}var p=!s&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;p&&(a.save(),a._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[e](t,n)})),p&&a.restore(),l&&a.restore()}getClientRect(e){var t,n,r,a,o,c,i=(e=e||{}).skipTransform,l=e.relativeTo,s=this;null===(t=this.children)||void 0===t||t.forEach((function(t){if(t.visible()){var c=t.getClientRect({relativeTo:s,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===c.width&&0===c.height||(void 0===n?(n=c.x,r=c.y,a=c.x+c.width,o=c.y+c.height):(n=Math.min(n,c.x),r=Math.min(r,c.y),a=Math.max(a,c.x+c.width),o=Math.max(o,c.y+c.height)))}}));for(var h=this.find("Shape"),d=!1,u=0;u<h.length;u++)if(h[u]._isVisible(this)){d=!0;break}return c=d&&void 0!==n?{x:n,y:r,width:a-n,height:o-r}:{x:0,y:0,width:0,height:0},i?c:this._transformedRect(c,l)}}pse.addComponentsGetterSetter(Bse,"clip",["x","y","width","height"]),pse.addGetterSetter(Bse,"clipX",void 0,cse()),pse.addGetterSetter(Bse,"clipY",void 0,cse()),pse.addGetterSetter(Bse,"clipWidth",void 0,cse()),pse.addGetterSetter(Bse,"clipHeight",void 0,cse()),pse.addGetterSetter(Bse,"clipFunc");const jse=new Map,Use=void 0!==Gle._global.PointerEvent;function Wse(e){return jse.get(e)}function $se(e){return{evt:e,pointerId:e.pointerId}}function qse(e,t){return jse.get(e)===t}function Gse(e,t){Yse(e),t.getStage()&&(jse.set(e,t),Use&&t._fire("gotpointercapture",$se(new PointerEvent("gotpointercapture"))))}function Yse(e,t){const n=jse.get(e);if(!n)return;const r=n.getStage();r&&r.content,jse.delete(e),Use&&n._fire("lostpointercapture",$se(new PointerEvent("lostpointercapture")))}var Kse="mouseleave",Xse="mouseover",Qse="mouseenter",Jse="mousemove",Zse="mousedown",ehe="mouseup",the="pointermove",nhe="pointerdown",rhe="pointerup",ahe="pointercancel",ohe="pointerout",che="pointerleave",ihe="pointerover",lhe="pointerenter",she="contextmenu",hhe="touchstart",dhe="touchend",uhe="touchmove",mhe="touchcancel",phe="wheel",vhe=[[Qse,"_pointerenter"],[Zse,"_pointerdown"],[Jse,"_pointermove"],[ehe,"_pointerup"],[Kse,"_pointerleave"],[hhe,"_pointerdown"],[uhe,"_pointermove"],[dhe,"_pointerup"],[mhe,"_pointercancel"],[Xse,"_pointerover"],[phe,"_wheel"],[she,"_contextmenu"],[nhe,"_pointerdown"],[the,"_pointermove"],[rhe,"_pointerup"],[ahe,"_pointercancel"],["lostpointercapture","_lostpointercapture"]];const fhe={mouse:{[ohe]:"mouseout",[che]:Kse,[ihe]:Xse,[lhe]:Qse,[the]:Jse,[nhe]:Zse,[rhe]:ehe,[ahe]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[ohe]:"touchout",[che]:"touchleave",[ihe]:"touchover",[lhe]:"touchenter",[the]:uhe,[nhe]:hhe,[rhe]:dhe,[ahe]:mhe,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[ohe]:ohe,[che]:che,[ihe]:ihe,[lhe]:lhe,[the]:the,[nhe]:nhe,[rhe]:rhe,[ahe]:ahe,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},zhe=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",ghe=e=>{const t=zhe(e);return"pointer"===t?Gle.pointerEventsEnabled&&fhe.pointer:"touch"===t?fhe.touch:"mouse"===t?fhe.mouse:void 0};function yhe(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&rse.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const Mhe=[];class Ehe extends Bse{constructor(e){super(yhe(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Mhe.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(()=>{yhe(this.attrs)})),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||rse.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e,t=this.children,n=t.length;for(e=0;e<n;e++)t[e].clear();return this}clone(e){return e||(e={}),e.container="undefined"!=typeof document&&document.createElement("div"),Bse.prototype.clone.call(this,e)}destroy(){super.destroy();var e=this.content;e&&rse._isInDocument(e)&&this.container().removeChild(e);var t=Mhe.indexOf(this);return t>-1&&Mhe.splice(t,1),rse.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(rse.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(e){return this._pointerPositions.find((t=>t.id===e))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new Ese({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach((function(t){if(t.isVisible()){var r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),t}getIntersection(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){const r=n[t].getIntersection(e);if(r)return r}return null}_resizeDOM(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach((n=>{n.setSize({width:e,height:t}),n.draw()}))}add(e,...t){if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}super.add(e);var r=this.children.length;return r>5&&rse.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),Gle.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return qse(e,this)}setPointerCapture(e){Gse(e,this)}releaseCapture(e){Yse(e)}getLayers(){return this.children}_bindContentEvents(){Gle.isBrowser&&vhe.forEach((([e,t])=>{this.content.addEventListener(e,(e=>{this[t](e)}),{passive:!1})}))}_pointerenter(e){this.setPointersPositions(e);const t=ghe(e.type);this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=ghe(e.type);this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=ghe(e.type),n=zhe(e.type);if(t){this.setPointersPositions(e);var r=this._getTargetShape(n),a=!Hse.isDragging||Gle.hitOnDragEnabled;r&&a?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):a&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const t=ghe(e.type),n=zhe(e.type);if(t){this.setPointersPositions(e);var r=!1;this._changedPointerPositions.forEach((a=>{var o=this.getIntersection(a);if(Hse.justDragged=!1,Gle["_"+n+"ListenClick"]=!0,!o||!o.isListening())return;Gle.capturePointerEventsEnabled&&o.setPointerCapture(a.id),this[n+"ClickStartShape"]=o,o._fireAndBubble(t.pointerdown,{evt:e,pointerId:a.id}),r=!0;const c=e.type.indexOf("touch")>=0;o.preventDefault()&&e.cancelable&&c&&e.preventDefault()})),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const t=ghe(e.type),n=zhe(e.type);if(!t)return;if(Hse.isDragging&&Hse.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),Hse.isDragging&&!Gle.hitOnDragEnabled)return;var r={};let a=!1;var o=this._getTargetShape(n);this._changedPointerPositions.forEach((c=>{const i=Wse(c.id)||this.getIntersection(c),l=c.id,s={evt:e,pointerId:l};var h=o!==i;if(h&&o&&(o._fireAndBubble(t.pointerout,Object.assign({},s),i),o._fireAndBubble(t.pointerleave,Object.assign({},s),i)),i){if(r[i._id])return;r[i._id]=!0}i&&i.isListening()?(a=!0,h&&(i._fireAndBubble(t.pointerover,Object.assign({},s),o),i._fireAndBubble(t.pointerenter,Object.assign({},s),o),this[n+"targetShape"]=i),i._fireAndBubble(t.pointermove,Object.assign({},s))):o&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:l}),this[n+"targetShape"]=null)})),a||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=ghe(e.type),n=zhe(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],a=this[n+"ClickEndShape"];var o={};let c=!1;this._changedPointerPositions.forEach((i=>{const l=Wse(i.id)||this.getIntersection(i);if(l){if(l.releaseCapture(i.id),o[l._id])return;o[l._id]=!0}const s=i.id,h={evt:e,pointerId:s};let d=!1;Gle["_"+n+"InDblClickWindow"]?(d=!0,clearTimeout(this[n+"DblTimeout"])):Hse.justDragged||(Gle["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){Gle["_"+n+"InDblClickWindow"]=!1}),Gle.dblClickWindow),l&&l.isListening()?(c=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,Object.assign({},h)),Gle["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,Object.assign({},h)),d&&a&&a===l&&l._fireAndBubble(t.pointerdblclick,Object.assign({},h)))):(this[n+"ClickEndShape"]=null,Gle["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:s}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:s}))})),c||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),Gle["_"+n+"ListenClick"]=!1,e.cancelable&&"touch"!==n&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(she,{evt:e}):this._fire(she,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(phe,{evt:e}):this._fire(phe,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=Wse(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(rhe,$se(e)),Yse(e.pointerId)}_lostpointercapture(e){Yse(e.pointerId)}setPointersPositions(e){var t=this._getContentPosition(),n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})})),Array.prototype.forEach.call(e.changedTouches||e.touches,(e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:rse._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:rse._getFirstPointerId(e)}])}_setPointerPosition(e){rse.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ese({width:this.width(),height:this.height()}),this.bufferHitCanvas=new bse({pixelRatio:1,width:this.width(),height:this.height()}),Gle.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}cache(){return rse.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(e){e.batchDraw()})),this}}Ehe.prototype.nodeType="Stage",Yle(Ehe),pse.addGetterSetter(Ehe,"container");var bhe="hasShadow",Hhe="shadowRGBA",Vhe="patternImage",Che="linearGradient",Lhe="radialGradient";let khe;function whe(){return khe||(khe=rse.createCanvasElement().getContext("2d"),khe)}const She={};class xhe extends Fse{constructor(e){let t;for(super(e);t=rse.getRandomColor(),!t||t in She;);this.colorKey=t,She[t]=this}getContext(){return rse.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return rse.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(bhe,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Vhe,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=whe().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new Kle;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(Gle.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Che,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var t=whe(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),a=t.createLinearGradient(n.x,n.y,r.x,r.y),o=0;o<e.length;o+=2)a.addColorStop(e[o],e[o+1]);return a}}_getRadialGradient(){return this._getCache(Lhe,this.__getRadialGradient)}__getRadialGradient(){var e=this.fillRadialGradientColorStops();if(e){for(var t=whe(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),a=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius()),o=0;o<e.length;o+=2)a.addColorStop(e[o],e[o+1]);return a}}getShadowRGBA(){return this._getCache(Hhe,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var e=rse.colorToRGBA(this.shadowColor());return e?"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")":void 0}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],(()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var t=this.getStage().bufferHitCanvas;return t.getContext().clear(),this.drawHit(t,null,!0),t.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return Fse.prototype.destroy.call(this),delete She[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!this.getStage())return!1;if(null!==(t=this.attrs.perfectDrawEnabled)&&void 0!==t&&!t)return!1;const n=e||this.hasFill(),r=this.hasStroke(),a=1!==this.getAbsoluteOpacity();if(n&&r&&a)return!0;const o=this.hasShadow(),c=this.shadowForStrokeEnabled();return!!(n&&r&&o&&c)}setStrokeHitEnabled(e){rse.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const t=e.skipTransform,n=e.relativeTo,r=this.getSelfRect(),a=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=r.width+a,c=r.height+a,i=!e.skipShadow&&this.hasShadow(),l=i?this.shadowOffsetX():0,s=i?this.shadowOffsetY():0,h=o+Math.abs(l),d=c+Math.abs(s),u=i&&this.shadowBlur()||0,m={width:h+2*u,height:d+2*u,x:-(a/2+u)+Math.min(l,0)+r.x,y:-(a/2+u)+Math.min(s,0)+r.y};return t?m:this._transformedRect(m,n)}drawScene(e,t){var n,r,a=this.getLayer(),o=e||a.getCanvas(),c=o.getContext(),i=this._getCanvasCache(),l=this.getSceneFunc(),s=this.hasShadow(),h=o.isCache,d=t===this;if(!this.isVisible()&&!d)return this;if(i){c.save();var u=this.getAbsoluteTransform(t).getMatrix();return c.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(c),c.restore(),this}if(!l)return this;if(c.save(),this._useBufferCanvas()&&!h){(r=(n=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var m=this.getAbsoluteTransform(t).getMatrix();r.transform(m[0],m[1],m[2],m[3],m[4],m[5]),l.call(this,r,this),r.restore();var p=n.pixelRatio;s&&c._applyShadow(this),c._applyOpacity(this),c._applyGlobalCompositeOperation(this),c.drawImage(n._canvas,0,0,n.width/p,n.height/p)}else c._applyLineJoin(this),d||(m=this.getAbsoluteTransform(t).getMatrix(),c.transform(m[0],m[1],m[2],m[3],m[4],m[5]),c._applyOpacity(this),c._applyGlobalCompositeOperation(this)),s&&c._applyShadow(this),l.call(this,c,this);return c.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;var r=this.getLayer(),a=e||r.hitCanvas,o=a&&a.getContext(),c=this.hitFunc()||this.sceneFunc(),i=this._getCanvasCache(),l=i&&i.hit;if(this.colorKey||rse.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){o.save();var s=this.getAbsoluteTransform(t).getMatrix();return o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!c)return this;if(o.save(),o._applyLineJoin(this),this!==t){var h=this.getAbsoluteTransform(t).getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5])}return c.call(this,o,this),o.restore(),this}drawHitFromCache(e=0){var t,n,r,a,o,c=this._getCanvasCache(),i=this._getCachedSceneCanvas(),l=c.hit,s=l.getContext(),h=l.getWidth(),d=l.getHeight();s.clear(),s.drawImage(i._canvas,0,0,h,d);try{for(r=(n=(t=s.getImageData(0,0,h,d)).data).length,a=rse._hexToRgb(this.colorKey),o=0;o<r;o+=4)n[o+3]>e?(n[o]=a.r,n[o+1]=a.g,n[o+2]=a.b,n[o+3]=255):n[o+3]=0;s.putImageData(t,0,0)}catch(e){rse.error("Unable to draw hit graph from cached scene canvas. "+e.message)}return this}hasPointerCapture(e){return qse(e,this)}setPointerCapture(e){Gse(e,this)}releaseCapture(e){Yse(e)}}xhe.prototype._fillFunc=function(e){e.fill()},xhe.prototype._strokeFunc=function(e){e.stroke()},xhe.prototype._fillFuncHit=function(e){e.fill()},xhe.prototype._strokeFuncHit=function(e){e.stroke()},xhe.prototype._centroid=!1,xhe.prototype.nodeType="Shape",Yle(xhe),xhe.prototype.eventListeners={},xhe.prototype.on.call(xhe.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(bhe)})),xhe.prototype.on.call(xhe.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Hhe)})),xhe.prototype.on.call(xhe.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(Vhe)})),xhe.prototype.on.call(xhe.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(Che)})),xhe.prototype.on.call(xhe.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(Lhe)})),pse.addGetterSetter(xhe,"stroke",void 0,hse()),pse.addGetterSetter(xhe,"strokeWidth",2,cse()),pse.addGetterSetter(xhe,"fillAfterStrokeEnabled",!1),pse.addGetterSetter(xhe,"hitStrokeWidth","auto",lse()),pse.addGetterSetter(xhe,"strokeHitEnabled",!0,dse()),pse.addGetterSetter(xhe,"perfectDrawEnabled",!0,dse()),pse.addGetterSetter(xhe,"shadowForStrokeEnabled",!0,dse()),pse.addGetterSetter(xhe,"lineJoin"),pse.addGetterSetter(xhe,"lineCap"),pse.addGetterSetter(xhe,"sceneFunc"),pse.addGetterSetter(xhe,"hitFunc"),pse.addGetterSetter(xhe,"dash"),pse.addGetterSetter(xhe,"dashOffset",0,cse()),pse.addGetterSetter(xhe,"shadowColor",void 0,sse()),pse.addGetterSetter(xhe,"shadowBlur",0,cse()),pse.addGetterSetter(xhe,"shadowOpacity",1,cse()),pse.addComponentsGetterSetter(xhe,"shadowOffset",["x","y"]),pse.addGetterSetter(xhe,"shadowOffsetX",0,cse()),pse.addGetterSetter(xhe,"shadowOffsetY",0,cse()),pse.addGetterSetter(xhe,"fillPatternImage"),pse.addGetterSetter(xhe,"fill",void 0,hse()),pse.addGetterSetter(xhe,"fillPatternX",0,cse()),pse.addGetterSetter(xhe,"fillPatternY",0,cse()),pse.addGetterSetter(xhe,"fillLinearGradientColorStops"),pse.addGetterSetter(xhe,"strokeLinearGradientColorStops"),pse.addGetterSetter(xhe,"fillRadialGradientStartRadius",0),pse.addGetterSetter(xhe,"fillRadialGradientEndRadius",0),pse.addGetterSetter(xhe,"fillRadialGradientColorStops"),pse.addGetterSetter(xhe,"fillPatternRepeat","repeat"),pse.addGetterSetter(xhe,"fillEnabled",!0),pse.addGetterSetter(xhe,"strokeEnabled",!0),pse.addGetterSetter(xhe,"shadowEnabled",!0),pse.addGetterSetter(xhe,"dashEnabled",!0),pse.addGetterSetter(xhe,"strokeScaleEnabled",!0),pse.addGetterSetter(xhe,"fillPriority","color"),pse.addComponentsGetterSetter(xhe,"fillPatternOffset",["x","y"]),pse.addGetterSetter(xhe,"fillPatternOffsetX",0,cse()),pse.addGetterSetter(xhe,"fillPatternOffsetY",0,cse()),pse.addComponentsGetterSetter(xhe,"fillPatternScale",["x","y"]),pse.addGetterSetter(xhe,"fillPatternScaleX",1,cse()),pse.addGetterSetter(xhe,"fillPatternScaleY",1,cse()),pse.addComponentsGetterSetter(xhe,"fillLinearGradientStartPoint",["x","y"]),pse.addComponentsGetterSetter(xhe,"strokeLinearGradientStartPoint",["x","y"]),pse.addGetterSetter(xhe,"fillLinearGradientStartPointX",0),pse.addGetterSetter(xhe,"strokeLinearGradientStartPointX",0),pse.addGetterSetter(xhe,"fillLinearGradientStartPointY",0),pse.addGetterSetter(xhe,"strokeLinearGradientStartPointY",0),pse.addComponentsGetterSetter(xhe,"fillLinearGradientEndPoint",["x","y"]),pse.addComponentsGetterSetter(xhe,"strokeLinearGradientEndPoint",["x","y"]),pse.addGetterSetter(xhe,"fillLinearGradientEndPointX",0),pse.addGetterSetter(xhe,"strokeLinearGradientEndPointX",0),pse.addGetterSetter(xhe,"fillLinearGradientEndPointY",0),pse.addGetterSetter(xhe,"strokeLinearGradientEndPointY",0),pse.addComponentsGetterSetter(xhe,"fillRadialGradientStartPoint",["x","y"]),pse.addGetterSetter(xhe,"fillRadialGradientStartPointX",0),pse.addGetterSetter(xhe,"fillRadialGradientStartPointY",0),pse.addComponentsGetterSetter(xhe,"fillRadialGradientEndPoint",["x","y"]),pse.addGetterSetter(xhe,"fillRadialGradientEndPointX",0),pse.addGetterSetter(xhe,"fillRadialGradientEndPointY",0),pse.addGetterSetter(xhe,"fillPatternRotation",0),pse.backCompat(xhe,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var The=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Ohe=The.length;class Ahe extends Bse{constructor(e){super(e),this.canvas=new Ese,this.hitCanvas=new bse({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Fse.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!Fse.prototype.moveUp.call(this))return!1;var e=this.getStage();return!(!e||!e.content||(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),0))}moveDown(){if(Fse.prototype.moveDown.call(this)){var e=this.getStage();if(e){var t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Fse.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return Fse.prototype.remove.call(this),e&&e.parentNode&&rse._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&rse.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return(e=e||{}).width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=void 0!==e.x?e.x:this.x(),e.y=void 0!==e.y?e.y:this.y(),Fse.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){const e=this.visible();this.canvas._canvas.style.display=e?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){rse.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){rse.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,rse.requestAnimFrame((()=>{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var t=1,n=!1;;){for(let r=0;r<Ohe;r++){const a=The[r],o=this._getIntersection({x:e.x+a.x*t,y:e.y+a.y*t}),c=o.shape;if(c)return c;if(n=!!o.antialiased,!o.antialiased)break}if(!n)return null;t+=1}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(255===r){const e=rse._rgbToHex(n[0],n[1],n[2]),t=She["#"+e];return t?{shape:t}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Bse.prototype.drawScene.call(this,r,t),this._fire("draw",{node:this}),this}drawHit(e,t){var n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Bse.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){rse.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return rse.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return rse.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Ahe.prototype.nodeType="Layer",Yle(Ahe),pse.addGetterSetter(Ahe,"imageSmoothingEnabled",!0),pse.addGetterSetter(Ahe,"clearBeforeDraw",!0),pse.addGetterSetter(Ahe,"hitGraphEnabled",!0,dse());class Rhe extends Ahe{constructor(e){super(e),this.listening(!1),rse.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Rhe.prototype.nodeType="FastLayer",Yle(Rhe);class Nhe extends Bse{_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&rse.throw("You may only add groups and shapes to groups.")}}Nhe.prototype.nodeType="Group",Yle(Nhe);var _he=qle.performance&&qle.performance.now?function(){return qle.performance.now()}:function(){return(new Date).getTime()};class Dhe{constructor(e,t){this.id=Dhe.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:_he(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){var t;return t=e?e.length>0?e:[e]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(e){var t,n=this.layers,r=n.length;for(t=0;t<r;t++)if(n[t]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){var e,t=Dhe.animations,n=t.length;for(e=0;e<n;e++)if(t[e].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=_he(),Dhe._addAnimation(this),this}stop(){return Dhe._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){var t,n=e.id,r=this.animations,a=r.length;for(t=0;t<a;t++)if(r[t].id===n){this.animations.splice(t,1);break}}static _runFrames(){var e,t,n,r,a,o,c,i,l={},s=this.animations;for(r=0;r<s.length;r++)if(t=(e=s[r]).layers,n=e.func,e._updateFrameObject(_he()),o=t.length,!n||!1!==n.call(e,e.frame))for(a=0;a<o;a++)void 0!==(c=t[a])._id&&(l[c._id]=c);for(i in l)l.hasOwnProperty(i)&&l[i].batchDraw()}static _animationLoop(){var e=Dhe;e.animations.length?(e._runFrames(),rse.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,rse.requestAnimFrame(this._animationLoop))}}Dhe.animations=[],Dhe.animIdCounter=0,Dhe.animRunning=!1;var Phe={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Fhe=0,Ihe=["fill","stroke","shadowColor"];class Bhe{constructor(e,t,n,r,a,o,c){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=o,this._change=0,this.prevPos=0,this.yoyo=c,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=a-this.begin,this.pause()}fire(e){var t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class jhe{constructor(e){var t,n,r=this,a=e.node,o=a._id,c=e.easing||Uhe.Linear,i=!!e.yoyo;t=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=a,this._id=Fhe++;var l=a.getLayer()||(a instanceof Gle.Stage?a.getLayers():null);for(n in l||rse.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Dhe((function(){r.tween.onEnterFrame()}),l),this.tween=new Bhe(n,(function(e){r._tweenFunc(e)}),c,0,1,1e3*t,i),this._addListeners(),jhe.attrs[o]||(jhe.attrs[o]={}),jhe.attrs[o][this._id]||(jhe.attrs[o][this._id]={}),jhe.tweens[o]||(jhe.tweens[o]={}),e)void 0===Phe[n]&&this._addAttr(n,e[n]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){var n,r,a,o,c,i,l,s,h=this.node,d=h._id;if((a=jhe.tweens[d][e])&&delete jhe.attrs[d][a][e],n=h.getAttr(e),rse._isArray(t))if(r=[],c=Math.max(t.length,n.length),"points"===e&&t.length!==n.length&&(t.length>n.length?(l=n,n=rse._prepareArrayForTween(n,t,h.closed())):(i=t,t=rse._prepareArrayForTween(t,n,h.closed()))),0===e.indexOf("fill"))for(o=0;o<c;o++)if(o%2==0)r.push(t[o]-n[o]);else{var u=rse.colorToRGBA(n[o]);s=rse.colorToRGBA(t[o]),n[o]=u,r.push({r:s.r-u.r,g:s.g-u.g,b:s.b-u.b,a:s.a-u.a})}else for(o=0;o<c;o++)r.push(t[o]-n[o]);else-1!==Ihe.indexOf(e)?(n=rse.colorToRGBA(n),r={r:(s=rse.colorToRGBA(t)).r-n.r,g:s.g-n.g,b:s.b-n.b,a:s.a-n.a}):r=t-n;jhe.attrs[d][this._id][e]={start:n,diff:r,end:t,trueEnd:i,trueStart:l},jhe.tweens[d][e]=this._id}_tweenFunc(e){var t,n,r,a,o,c,i,l,s=this.node,h=jhe.attrs[s._id][this._id];for(t in h){if(r=(n=h[t]).start,a=n.diff,l=n.end,rse._isArray(r))if(o=[],i=Math.max(r.length,l.length),0===t.indexOf("fill"))for(c=0;c<i;c++)c%2==0?o.push((r[c]||0)+a[c]*e):o.push("rgba("+Math.round(r[c].r+a[c].r*e)+","+Math.round(r[c].g+a[c].g*e)+","+Math.round(r[c].b+a[c].b*e)+","+(r[c].a+a[c].a*e)+")");else for(c=0;c<i;c++)o.push((r[c]||0)+a[c]*e);else o=-1!==Ihe.indexOf(t)?"rgba("+Math.round(r.r+a.r*e)+","+Math.round(r.g+a.g*e)+","+Math.round(r.b+a.b*e)+","+(r.a+a.a*e)+")":r+a*e;s.setAttr(t,o)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,t=jhe.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,t=jhe.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e,t=this.node._id,n=this._id,r=jhe.tweens[t];for(e in this.pause(),r)delete jhe.tweens[t][e];delete jhe.attrs[t][n]}}jhe.attrs={},jhe.tweens={},Fse.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new jhe(e).play()};const Uhe={BackEaseIn(e,t,n,r){var a=1.70158;return n*(e/=r)*e*((a+1)*e-a)+t},BackEaseOut(e,t,n,r){var a=1.70158;return n*((e=e/r-1)*e*((a+1)*e+a)+1)+t},BackEaseInOut(e,t,n,r){var a=1.70158;return(e/=r/2)<1?n/2*(e*e*((1+(a*=1.525))*e-a))+t:n/2*((e-=2)*e*((1+(a*=1.525))*e+a)+2)+t},ElasticEaseIn(e,t,n,r,a,o){var c=0;return 0===e?t:1==(e/=r)?t+n:(o||(o=.3*r),!a||a<Math.abs(n)?(a=n,c=o/4):c=o/(2*Math.PI)*Math.asin(n/a),-a*Math.pow(2,10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/o)+t)},ElasticEaseOut(e,t,n,r,a,o){var c=0;return 0===e?t:1==(e/=r)?t+n:(o||(o=.3*r),!a||a<Math.abs(n)?(a=n,c=o/4):c=o/(2*Math.PI)*Math.asin(n/a),a*Math.pow(2,-10*e)*Math.sin((e*r-c)*(2*Math.PI)/o)+n+t)},ElasticEaseInOut(e,t,n,r,a,o){var c=0;return 0===e?t:2==(e/=r/2)?t+n:(o||(o=r*(.3*1.5)),!a||a<Math.abs(n)?(a=n,c=o/4):c=o/(2*Math.PI)*Math.asin(n/a),e<1?a*Math.pow(2,10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/o)*-.5+t:a*Math.pow(2,-10*(e-=1))*Math.sin((e*r-c)*(2*Math.PI)/o)*.5+n+t)},BounceEaseOut:(e,t,n,r)=>(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t,BounceEaseIn:(e,t,n,r)=>n-Uhe.BounceEaseOut(r-e,0,n,r)+t,BounceEaseInOut:(e,t,n,r)=>e<r/2?.5*Uhe.BounceEaseIn(2*e,0,n,r)+t:.5*Uhe.BounceEaseOut(2*e-r,0,n,r)+.5*n+t,EaseIn:(e,t,n,r)=>n*(e/=r)*e+t,EaseOut:(e,t,n,r)=>-n*(e/=r)*(e-2)+t,EaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,r)=>n*(e/=r)*e*e*e*e+t,StrongEaseOut:(e,t,n,r)=>n*((e=e/r-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,r)=>(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,r)=>n*e/r+t},Whe=rse._assign(Gle,{Util:rse,Transform:Kle,Node:Fse,Container:Bse,Stage:Ehe,stages:Mhe,Layer:Ahe,FastLayer:Rhe,Group:Nhe,DD:Hse,Shape:xhe,shapes:She,Animation:Dhe,Tween:jhe,Easings:Uhe,Context:zse,Canvas:Mse});class $he extends xhe{_sceneFunc(e){var t=Gle.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=Gle.getAngle(n?360-this.angle():this.angle()),a=Math.cos(Math.min(r,Math.PI)),o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),c=Math.sin(Math.min(r,Math.PI/2)),i=a*(a>0?e:t),l=o*(o>0?e:t),s=c*(c>0?t:e);return{x:i,y:n?-1*s:l,width:1*t-i,height:s-l}}}function qhe(e,t,n,r,a,o,c){var i=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(a-n,2)+Math.pow(o-r,2)),s=c*i/(i+l),h=c*l/(i+l);return[n-s*(a-e),r-s*(o-t),n+h*(a-e),r+h*(o-t)]}function Ghe(e,t){var n,r,a=e.length,o=[];for(n=2;n<a-2;n+=2)r=qhe(e[n-2],e[n-1],e[n],e[n+1],e[n+2],e[n+3],t),isNaN(r[0])||(o.push(r[0]),o.push(r[1]),o.push(e[n]),o.push(e[n+1]),o.push(r[2]),o.push(r[3]));return o}$he.prototype._centroid=!0,$he.prototype.className="Arc",$he.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Yle($he),pse.addGetterSetter($he,"innerRadius",0,cse()),pse.addGetterSetter($he,"outerRadius",0,cse()),pse.addGetterSetter($he,"angle",0,cse()),pse.addGetterSetter($he,"clockwise",!1,dse());class Yhe extends xhe{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")}))}_sceneFunc(e){var t,n,r,a=this.points(),o=a.length,c=this.tension(),i=this.closed(),l=this.bezier();if(o){if(e.beginPath(),e.moveTo(a[0],a[1]),0!==c&&o>4){for(n=(t=this.getTensionPoints()).length,r=i?0:4,i||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);r<n-2;)e.bezierCurveTo(t[r++],t[r++],t[r++],t[r++],t[r++],t[r++]);i||e.quadraticCurveTo(t[n-2],t[n-1],a[o-2],a[o-1])}else if(l)for(r=2;r<o;)e.bezierCurveTo(a[r++],a[r++],a[r++],a[r++],a[r++],a[r++]);else for(r=2;r<o;r+=2)e.lineTo(a[r],a[r+1]);i?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Ghe(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),t=e.length,n=this.tension(),r=qhe(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),a=qhe(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),o=Ghe(e,n);return[r[2],r[3]].concat(o).concat([a[0],a[1],e[t-2],e[t-1],a[2],a[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};for(var t,n,r=(e=0!==this.tension()?[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.points())[0],a=e[0],o=e[1],c=e[1],i=0;i<e.length/2;i++)t=e[2*i],n=e[2*i+1],r=Math.min(r,t),a=Math.max(a,t),o=Math.min(o,n),c=Math.max(c,n);return{x:r,y:o,width:a-r,height:c-o}}}Yhe.prototype.className="Line",Yhe.prototype._attrsAffectingSize=["points","bezier","tension"],Yle(Yhe),pse.addGetterSetter(Yhe,"closed",!1),pse.addGetterSetter(Yhe,"bezier",!1),pse.addGetterSetter(Yhe,"tension",0,cse()),pse.addGetterSetter(Yhe,"points",[],function(){if(Gle.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(rse._isArray(e)?e.forEach((function(e){rse._isNumber(e)||rse.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")})):rse.warn(ase(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}());class Khe extends xhe{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this.dataArray=Khe.parsePathData(this.data()),this.pathLength=0;for(var t=0;t<this.dataArray.length;++t)this.pathLength+=this.dataArray[t].pathLength;this.on("dataChange.konva",(function(){this.dataArray=Khe.parsePathData(this.data()),this.pathLength=0;for(var e=0;e<this.dataArray.length;++e)this.pathLength+=this.dataArray[e].pathLength}))}_sceneFunc(e){var t=this.dataArray;e.beginPath();for(var n=!1,r=0;r<t.length;r++){var a=t[r].command,o=t[r].points;switch(a){case"L":e.lineTo(o[0],o[1]);break;case"M":e.moveTo(o[0],o[1]);break;case"C":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"Q":e.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case"A":var c=o[0],i=o[1],l=o[2],s=o[3],h=o[4],d=o[5],u=o[6],m=o[7],p=l>s?l:s,v=l>s?1:l/s,f=l>s?s/l:1;e.translate(c,i),e.rotate(u),e.scale(v,f),e.arc(0,0,p,h,h+d,1-m),e.scale(1/v,1/f),e.rotate(-u),e.translate(-c,-i);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach((function(t){if("A"===t.command){var n=t.points[4],r=t.points[5],a=t.points[4]+r,o=Math.PI/180;if(Math.abs(n-a)<o&&(o=Math.abs(n-a)),r<0)for(let r=n-o;r>a;r-=o){const n=Khe.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}else for(let r=n+o;r<a;r+=o){const n=Khe.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],r,0);e.push(n.x,n.y)}}else if("C"===t.command)for(let n=0;n<=1;n+=.01){const r=Khe.getPointOnCubicBezier(n,t.start.x,t.start.y,t.points[0],t.points[1],t.points[2],t.points[3],t.points[4],t.points[5]);e.push(r.x,r.y)}else e=e.concat(t.points)}));for(var t,n,r=e[0],a=e[0],o=e[1],c=e[1],i=0;i<e.length/2;i++)t=e[2*i],n=e[2*i+1],isNaN(t)||(r=Math.min(r,t),a=Math.max(a,t)),isNaN(n)||(o=Math.min(o,n),c=Math.max(c,n));return{x:r,y:o,width:a-r,height:c-o}}getLength(){return this.pathLength}getPointAtLength(e){var t,n=0,r=this.dataArray.length;if(!r)return null;for(;n<r&&e>this.dataArray[n].pathLength;)e-=this.dataArray[n].pathLength,++n;if(n===r)return{x:(t=this.dataArray[n-1].points.slice(-2))[0],y:t[1]};if(e<.01)return{x:(t=this.dataArray[n].points.slice(0,2))[0],y:t[1]};var a=this.dataArray[n],o=a.points;switch(a.command){case"L":return Khe.getPointOnLine(e,a.start.x,a.start.y,o[0],o[1]);case"C":return Khe.getPointOnCubicBezier(e/a.pathLength,a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return Khe.getPointOnQuadraticBezier(e/a.pathLength,a.start.x,a.start.y,o[0],o[1],o[2],o[3]);case"A":var c=o[0],i=o[1],l=o[2],s=o[3],h=o[4],d=o[5],u=o[6];return h+=d*e/a.pathLength,Khe.getPointOnEllipticalArc(c,i,l,s,h,u)}return null}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPointOnLine(e,t,n,r,a,o,c){void 0===o&&(o=t),void 0===c&&(c=n);var i=(a-n)/(r-t+1e-8),l=Math.sqrt(e*e/(1+i*i));r<t&&(l*=-1);var s,h=i*l;if(r===t)s={x:o,y:c+h};else if((c-n)/(o-t+1e-8)===i)s={x:o+l,y:c+h};else{var d,u,m=this.getLineLength(t,n,r,a),p=(o-t)*(r-t)+(c-n)*(a-n);d=t+(p/=m*m)*(r-t),u=n+p*(a-n);var v=this.getLineLength(o,c,d,u),f=Math.sqrt(e*e-v*v);l=Math.sqrt(f*f/(1+i*i)),r<t&&(l*=-1),s={x:d+l,y:u+(h=i*l)}}return s}static getPointOnCubicBezier(e,t,n,r,a,o,c,i,l){function s(e){return e*e*e}function h(e){return 3*e*e*(1-e)}function d(e){return 3*e*(1-e)*(1-e)}function u(e){return(1-e)*(1-e)*(1-e)}return{x:i*s(e)+o*h(e)+r*d(e)+t*u(e),y:l*s(e)+c*h(e)+a*d(e)+n*u(e)}}static getPointOnQuadraticBezier(e,t,n,r,a,o,c){function i(e){return e*e}function l(e){return 2*e*(1-e)}function s(e){return(1-e)*(1-e)}return{x:o*i(e)+r*l(e)+t*s(e),y:c*i(e)+a*l(e)+n*s(e)}}static getPointOnEllipticalArc(e,t,n,r,a,o){var c=Math.cos(o),i=Math.sin(o),l=n*Math.cos(a),s=r*Math.sin(a);return{x:e+(l*c-s*i),y:t+(l*i+s*c)}}static parsePathData(e){if(!e)return[];var t=e,n=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];t=t.replace(new RegExp(" ","g"),",");for(var r=0;r<n.length;r++)t=t.replace(new RegExp(n[r],"g"),"|"+n[r]);var a,o=t.split("|"),c=[],i=[],l=0,s=0,h=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;for(r=1;r<o.length;r++){var d=o[r],u=d.charAt(0);for(d=d.slice(1),i.length=0;a=h.exec(d);)i.push(a[0]);for(var m=[],p=0,v=i.length;p<v;p++)if("00"!==i[p]){var f=parseFloat(i[p]);isNaN(f)?m.push(0):m.push(f)}else m.push(0,0);for(;m.length>0&&!isNaN(m[0]);){var z,g,y,M,E,b,H,V,C,L,k=null,w=[],S=l,x=s;switch(u){case"l":l+=m.shift(),s+=m.shift(),k="L",w.push(l,s);break;case"L":l=m.shift(),s=m.shift(),w.push(l,s);break;case"m":var T=m.shift(),O=m.shift();if(l+=T,s+=O,k="M",c.length>2&&"z"===c[c.length-1].command)for(var A=c.length-2;A>=0;A--)if("M"===c[A].command){l=c[A].points[0]+T,s=c[A].points[1]+O;break}w.push(l,s),u="l";break;case"M":l=m.shift(),s=m.shift(),k="M",w.push(l,s),u="L";break;case"h":l+=m.shift(),k="L",w.push(l,s);break;case"H":l=m.shift(),k="L",w.push(l,s);break;case"v":s+=m.shift(),k="L",w.push(l,s);break;case"V":s=m.shift(),k="L",w.push(l,s);break;case"C":w.push(m.shift(),m.shift(),m.shift(),m.shift()),l=m.shift(),s=m.shift(),w.push(l,s);break;case"c":w.push(l+m.shift(),s+m.shift(),l+m.shift(),s+m.shift()),l+=m.shift(),s+=m.shift(),k="C",w.push(l,s);break;case"S":g=l,y=s,"C"===(z=c[c.length-1]).command&&(g=l+(l-z.points[2]),y=s+(s-z.points[3])),w.push(g,y,m.shift(),m.shift()),l=m.shift(),s=m.shift(),k="C",w.push(l,s);break;case"s":g=l,y=s,"C"===(z=c[c.length-1]).command&&(g=l+(l-z.points[2]),y=s+(s-z.points[3])),w.push(g,y,l+m.shift(),s+m.shift()),l+=m.shift(),s+=m.shift(),k="C",w.push(l,s);break;case"Q":w.push(m.shift(),m.shift()),l=m.shift(),s=m.shift(),w.push(l,s);break;case"q":w.push(l+m.shift(),s+m.shift()),l+=m.shift(),s+=m.shift(),k="Q",w.push(l,s);break;case"T":g=l,y=s,"Q"===(z=c[c.length-1]).command&&(g=l+(l-z.points[0]),y=s+(s-z.points[1])),l=m.shift(),s=m.shift(),k="Q",w.push(g,y,l,s);break;case"t":g=l,y=s,"Q"===(z=c[c.length-1]).command&&(g=l+(l-z.points[0]),y=s+(s-z.points[1])),l+=m.shift(),s+=m.shift(),k="Q",w.push(g,y,l,s);break;case"A":M=m.shift(),E=m.shift(),b=m.shift(),H=m.shift(),V=m.shift(),C=l,L=s,l=m.shift(),s=m.shift(),k="A",w=this.convertEndpointToCenterParameterization(C,L,l,s,H,V,M,E,b);break;case"a":M=m.shift(),E=m.shift(),b=m.shift(),H=m.shift(),V=m.shift(),C=l,L=s,l+=m.shift(),s+=m.shift(),k="A",w=this.convertEndpointToCenterParameterization(C,L,l,s,H,V,M,E,b)}c.push({command:k||u,points:w,start:{x:S,y:x},pathLength:this.calcLength(S,x,k||u,w)})}"z"!==u&&"Z"!==u||c.push({command:"z",points:[],start:void 0,pathLength:0})}return c}static calcLength(e,t,n,r){var a,o,c,i,l=Khe;switch(n){case"L":return l.getLineLength(e,t,r[0],r[1]);case"C":for(a=0,o=l.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),i=.01;i<=1;i+=.01)c=l.getPointOnCubicBezier(i,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),a+=l.getLineLength(o.x,o.y,c.x,c.y),o=c;return a;case"Q":for(a=0,o=l.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),i=.01;i<=1;i+=.01)c=l.getPointOnQuadraticBezier(i,e,t,r[0],r[1],r[2],r[3]),a+=l.getLineLength(o.x,o.y,c.x,c.y),o=c;return a;case"A":a=0;var s=r[4],h=r[5],d=r[4]+h,u=Math.PI/180;if(Math.abs(s-d)<u&&(u=Math.abs(s-d)),o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],s,0),h<0)for(i=s-u;i>d;i-=u)c=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],i,0),a+=l.getLineLength(o.x,o.y,c.x,c.y),o=c;else for(i=s+u;i<d;i+=u)c=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],i,0),a+=l.getLineLength(o.x,o.y,c.x,c.y),o=c;return c=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],d,0),a+l.getLineLength(o.x,o.y,c.x,c.y)}return 0}static convertEndpointToCenterParameterization(e,t,n,r,a,o,c,i,l){var s=l*(Math.PI/180),h=Math.cos(s)*(e-n)/2+Math.sin(s)*(t-r)/2,d=-1*Math.sin(s)*(e-n)/2+Math.cos(s)*(t-r)/2,u=h*h/(c*c)+d*d/(i*i);u>1&&(c*=Math.sqrt(u),i*=Math.sqrt(u));var m=Math.sqrt((c*c*(i*i)-c*c*(d*d)-i*i*(h*h))/(c*c*(d*d)+i*i*(h*h)));a===o&&(m*=-1),isNaN(m)&&(m=0);var p=m*c*d/i,v=m*-i*h/c,f=(e+n)/2+Math.cos(s)*p-Math.sin(s)*v,z=(t+r)/2+Math.sin(s)*p+Math.cos(s)*v,g=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},y=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(g(e)*g(t))},M=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(y(e,t))},E=M([1,0],[(h-p)/c,(d-v)/i]),b=[(h-p)/c,(d-v)/i],H=[(-1*h-p)/c,(-1*d-v)/i],V=M(b,H);return y(b,H)<=-1&&(V=Math.PI),y(b,H)>=1&&(V=0),0===o&&V>0&&(V-=2*Math.PI),1===o&&V<0&&(V+=2*Math.PI),[f,z,c,i,E,V,s,o]}}Khe.prototype.className="Path",Khe.prototype._attrsAffectingSize=["data"],Yle(Khe),pse.addGetterSetter(Khe,"data");class Xhe extends Yhe{_sceneFunc(e){super._sceneFunc(e);var t=2*Math.PI,n=this.points(),r=n,a=0!==this.tension()&&n.length>4;a&&(r=this.getTensionPoints());var o,c,i=this.pointerLength(),l=n.length;if(a){const e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[l-2],n[l-1]],t=Khe.calcLength(r[r.length-4],r[r.length-3],"C",e),a=Khe.getPointOnQuadraticBezier(Math.min(1,1-i/t),e[0],e[1],e[2],e[3],e[4],e[5]);o=n[l-2]-a.x,c=n[l-1]-a.y}else o=n[l-2]-n[l-4],c=n[l-1]-n[l-3];var s=(Math.atan2(c,o)+t)%t,h=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[l-2],n[l-1]),e.rotate(s),e.moveTo(0,0),e.lineTo(-i,h/2),e.lineTo(-i,-h/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),a?(o=(r[0]+r[2])/2-n[0],c=(r[1]+r[3])/2-n[1]):(o=n[2]-n[0],c=n[3]-n[1]),e.rotate((Math.atan2(-c,-o)+t)%t),e.moveTo(0,0),e.lineTo(-i,h/2),e.lineTo(-i,-h/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}Xhe.prototype.className="Arrow",Yle(Xhe),pse.addGetterSetter(Xhe,"pointerLength",10,cse()),pse.addGetterSetter(Xhe,"pointerWidth",10,cse()),pse.addGetterSetter(Xhe,"pointerAtBeginning",!1),pse.addGetterSetter(Xhe,"pointerAtEnding",!0);class Qhe extends xhe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Qhe.prototype._centroid=!0,Qhe.prototype.className="Circle",Qhe.prototype._attrsAffectingSize=["radius"],Yle(Qhe),pse.addGetterSetter(Qhe,"radius",0,cse());class Jhe extends xhe{_sceneFunc(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Jhe.prototype.className="Ellipse",Jhe.prototype._centroid=!0,Jhe.prototype._attrsAffectingSize=["radiusX","radiusY"],Yle(Jhe),pse.addComponentsGetterSetter(Jhe,"radius",["x","y"]),pse.addGetterSetter(Jhe,"radiusX",0,cse()),pse.addGetterSetter(Jhe,"radiusY",0,cse());class Zhe extends xhe{constructor(e){super(e),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&4===e.readyState||e&&e.addEventListener&&e.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const t=this.getWidth(),n=this.getHeight(),r=this.cornerRadius(),a=this.attrs.image;let o;if(a){const e=this.attrs.cropWidth,r=this.attrs.cropHeight;o=e&&r?[a,this.cropX(),this.cropY(),e,r,0,0,t,n]:[a,0,0,t,n]}(this.hasFill()||this.hasStroke()||r)&&(e.beginPath(),r?rse.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),a&&(r&&e.clip(),e.drawImage.apply(e,o))}_hitFunc(e){var t=this.width(),n=this.height(),r=this.cornerRadius();e.beginPath(),r?rse.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}getHeight(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}static fromURL(e,t,n=null){var r=rse.createImageElement();r.onload=function(){var e=new Zhe({image:r});t(e)},r.onerror=n,r.crossOrigin="Anonymous",r.src=e}}Zhe.prototype.className="Image",Yle(Zhe),pse.addGetterSetter(Zhe,"cornerRadius",0,ise(4)),pse.addGetterSetter(Zhe,"image"),pse.addComponentsGetterSetter(Zhe,"crop",["x","y","width","height"]),pse.addGetterSetter(Zhe,"cropX",0,cse()),pse.addGetterSetter(Zhe,"cropY",0,cse()),pse.addGetterSetter(Zhe,"cropWidth",0,cse()),pse.addGetterSetter(Zhe,"cropHeight",0,cse());var ede=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],tde="up",nde="right",rde="down",ade="left",ode=ede.length;class cde extends Nhe{constructor(e){super(e),this.on("add.konva",(function(e){this._addListeners(e.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var t,n=this,r=function(){n._sync()};for(t=0;t<ode;t++)e.on(ede[t]+"Change.konva",r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e,t,n,r,a,o,c,i=this.getText(),l=this.getTag();if(i&&l){switch(e=i.width(),t=i.height(),n=l.pointerDirection(),r=l.pointerWidth(),c=l.pointerHeight(),a=0,o=0,n){case tde:a=e/2,o=-1*c;break;case nde:a=e+r,o=t/2;break;case rde:a=e/2,o=t+c;break;case ade:a=-1*r,o=t/2}l.setAttrs({x:-1*a,y:-1*o,width:e,height:t}),i.setAttrs({x:-1*a,y:-1*o})}}}cde.prototype.className="Label",Yle(cde);class ide extends xhe{_sceneFunc(e){var t=this.width(),n=this.height(),r=this.pointerDirection(),a=this.pointerWidth(),o=this.pointerHeight(),c=this.cornerRadius();let i=0,l=0,s=0,h=0;"number"==typeof c?i=l=s=h=Math.min(c,t/2,n/2):(i=Math.min(c[0]||0,t/2,n/2),l=Math.min(c[1]||0,t/2,n/2),h=Math.min(c[2]||0,t/2,n/2),s=Math.min(c[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(i,0),r===tde&&(e.lineTo((t-a)/2,0),e.lineTo(t/2,-1*o),e.lineTo((t+a)/2,0)),e.lineTo(t-l,0),e.arc(t-l,l,l,3*Math.PI/2,0,!1),r===nde&&(e.lineTo(t,(n-o)/2),e.lineTo(t+a,n/2),e.lineTo(t,(n+o)/2)),e.lineTo(t,n-h),e.arc(t-h,n-h,h,0,Math.PI/2,!1),r===rde&&(e.lineTo((t+a)/2,n),e.lineTo(t/2,n+o),e.lineTo((t-a)/2,n)),e.lineTo(s,n),e.arc(s,n-s,s,Math.PI/2,Math.PI,!1),r===ade&&(e.lineTo(0,(n+o)/2),e.lineTo(-1*a,n/2),e.lineTo(0,(n-o)/2)),e.lineTo(0,i),e.arc(i,i,i,Math.PI,3*Math.PI/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),a=this.pointerDirection(),o=this.width(),c=this.height();return a===tde?(t-=r,c+=r):a===rde?c+=r:a===ade?(e-=1.5*n,o+=n):a===nde&&(o+=1.5*n),{x:e,y:t,width:o,height:c}}}ide.prototype.className="Tag",Yle(ide),pse.addGetterSetter(ide,"pointerDirection","none"),pse.addGetterSetter(ide,"pointerWidth",0,cse()),pse.addGetterSetter(ide,"pointerHeight",0,cse()),pse.addGetterSetter(ide,"cornerRadius",0,ise(4));class lde extends xhe{_sceneFunc(e){var t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?rse.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}}lde.prototype.className="Rect",Yle(lde),pse.addGetterSetter(lde,"cornerRadius",0,ise(4));class sde extends xhe{_sceneFunc(e){const t=this._getPoints();e.beginPath(),e.moveTo(t[0].x,t[0].y);for(var n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(var r=0;r<e;r++)n.push({x:t*Math.sin(2*r*Math.PI/e),y:-1*t*Math.cos(2*r*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();var t=e[0].x,n=e[0].y,r=e[0].x,a=e[0].y;return e.forEach((e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),a=Math.max(a,e.y)})),{x:t,y:r,width:n-t,height:a-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}sde.prototype.className="RegularPolygon",sde.prototype._centroid=!0,sde.prototype._attrsAffectingSize=["radius"],Yle(sde),pse.addGetterSetter(sde,"radius",0,cse()),pse.addGetterSetter(sde,"sides",0,cse());var hde=2*Math.PI;class dde extends xhe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,hde,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),hde,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}dde.prototype.className="Ring",dde.prototype._centroid=!0,dde.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Yle(dde),pse.addGetterSetter(dde,"innerRadius",0,cse()),pse.addGetterSetter(dde,"outerRadius",0,cse());class ude extends xhe{constructor(e){super(e),this._updated=!0,this.anim=new Dhe((()=>{var e=this._updated;return this._updated=!1,e})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,a=this.animations()[t],o=this.frameOffsets(),c=a[r+0],i=a[r+1],l=a[r+2],s=a[r+3],h=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,s),e.closePath(),e.fillStrokeShape(this)),h)if(o){var d=o[t],u=2*n;e.drawImage(h,c,i,l,s,d[u+0],d[u+1],l,s)}else e.drawImage(h,c,i,l,s,0,0,l,s)}_hitFunc(e){var t=this.animation(),n=this.frameIndex(),r=4*n,a=this.animations()[t],o=this.frameOffsets(),c=a[r+2],i=a[r+3];if(e.beginPath(),o){var l=o[t],s=2*n;e.rect(l[s+0],l[s+1],c,i)}else e.rect(0,0,c,i);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval((function(){e._updateIndex()}),1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}}ude.prototype.className="Sprite",Yle(ude),pse.addGetterSetter(ude,"animation"),pse.addGetterSetter(ude,"animations"),pse.addGetterSetter(ude,"frameOffsets"),pse.addGetterSetter(ude,"image"),pse.addGetterSetter(ude,"frameIndex",0,cse()),pse.addGetterSetter(ude,"frameRate",17,cse()),pse.backCompat(ude,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class mde extends xhe{_sceneFunc(e){var t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(var a=1;a<2*r;a++){var o=a%2==0?n:t,c=o*Math.sin(a*Math.PI/r),i=-1*o*Math.cos(a*Math.PI/r);e.lineTo(c,i)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}function pde(e){return Array.from(e)}mde.prototype.className="Star",mde.prototype._centroid=!0,mde.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Yle(mde),pse.addGetterSetter(mde,"numPoints",5,cse()),pse.addGetterSetter(mde,"innerRadius",0,cse()),pse.addGetterSetter(mde,"outerRadius",0,cse());var vde,fde="auto",zde="justify",gde="left",yde="middle",Mde="normal",Ede=" ",bde="none",Hde=["fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Vde=Hde.length;function Cde(){return vde||(vde=rse.createCanvasElement().getContext("2d"))}class Lde extends xhe{constructor(e){super(function(e){return(e=e||{}).fillLinearGradientColorStops||e.fillRadialGradientColorStops||e.fillPatternImage||(e.fill=e.fill||"black"),e}(e)),this._partialTextX=0,this._partialTextY=0;for(var t=0;t<Vde;t++)this.on(Hde[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(e){var t=this.textArr,n=t.length;if(this.text()){var r,a=this.padding(),o=this.fontSize(),c=this.lineHeight()*o,i=this.verticalAlign(),l=0,s=this.align(),h=this.getWidth(),d=this.letterSpacing(),u=this.fill(),m=this.textDecoration(),p=-1!==m.indexOf("underline"),v=-1!==m.indexOf("line-through"),f=0,z=(f=c/2,0),g=0;for(e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",yde),e.setAttr("textAlign",gde),i===yde?l=(this.getHeight()-n*c-2*a)/2:"bottom"===i&&(l=this.getHeight()-n*c-2*a),e.translate(a,l+a),r=0;r<n;r++){z=0,g=0;var y,M,E,b=t[r],H=b.text,V=b.width,C=b.lastInParagraph;if(e.save(),"right"===s?z+=h-V-2*a:"center"===s&&(z+=(h-V-2*a)/2),p){e.save(),e.beginPath(),e.moveTo(z,f+g+Math.round(o/2)),M=0==(y=H.split(" ").length-1),E=s!==zde||C?V:h-2*a,e.lineTo(z+Math.round(E),f+g+Math.round(o/2)),e.lineWidth=o/15;const t=this._getLinearGradient();e.strokeStyle=t||u,e.stroke(),e.restore()}if(v){e.save(),e.beginPath(),e.moveTo(z,f+g),M=0==(y=H.split(" ").length-1),E=s===zde&&C&&!M?h-2*a:V,e.lineTo(z+Math.round(E),f+g),e.lineWidth=o/15;const t=this._getLinearGradient();e.strokeStyle=t||u,e.stroke(),e.restore()}if(0!==d||s===zde){y=H.split(" ").length-1;for(var L=pde(H),k=0;k<L.length;k++){var w=L[k];" "!==w||C||s!==zde||(z+=(h-2*a-V)/y),this._partialTextX=z,this._partialTextY=f+g,this._partialText=w,e.fillStrokeShape(this),z+=this.measureSize(w).width+d}}else this._partialTextX=z,this._partialTextY=f+g,this._partialText=H,e.fillStrokeShape(this);e.restore(),n>1&&(f+=c)}}}_hitFunc(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){var t=rse._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===fde||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===fde||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return rse.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n=Cde(),r=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{width:t.width,height:r}}_getContextFont(){return this.fontStyle()+Ede+this.fontVariant()+Ede+(this.fontSize()+"px ")+function(e){return e.split(",").map((e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e})).join(", ")}(this.fontFamily())}_addTextLine(e){this.align()===zde&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){var t=this.letterSpacing(),n=e.length;return Cde().measureText(e).width+(n?t*(n-1):0)}_setTextData(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,r=this.lineHeight()*t,a=this.attrs.width,o=this.attrs.height,c=a!==fde&&void 0!==a,i=o!==fde&&void 0!==o,l=this.padding(),s=a-2*l,h=o-2*l,d=0,u=this.wrap(),m="char"!==u&&u!==bde,p=this.ellipsis();this.textArr=[],Cde().font=this._getContextFont();for(var v=p?this._getTextWidth("…"):0,f=0,z=e.length;f<z;++f){var g=e[f],y=this._getTextWidth(g);if(c&&y>s)for(;g.length>0;){for(var M=0,E=g.length,b="",H=0;M<E;){var V=M+E>>>1,C=g.slice(0,V+1),L=this._getTextWidth(C)+v;L<=s?(M=V+1,b=C,H=L):E=V}if(!b)break;if(m){var k,w=g[b.length];(k=(w===Ede||"-"===w)&&H<=s?b.length:Math.max(b.lastIndexOf(Ede),b.lastIndexOf("-"))+1)>0&&(M=k,b=b.slice(0,M),H=this._getTextWidth(b))}if(b=b.trimRight(),this._addTextLine(b),n=Math.max(n,H),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if((g=(g=g.slice(M)).trimLeft()).length>0&&(y=this._getTextWidth(g))<=s){this._addTextLine(g),d+=r,n=Math.max(n,y);break}}else this._addTextLine(g),d+=r,n=Math.max(n,y),this._shouldHandleEllipsis(d)&&f<z-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),i&&d+r>h)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){var t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,a=r!==fde&&void 0!==r,o=r-2*this.padding();return!(this.wrap()!==bde)||a&&e+n>o}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,t=e!==fde&&void 0!==e,n=e-2*this.padding(),r=this.ellipsis(),a=this.textArr[this.textArr.length-1];a&&r&&(t&&(this._getTextWidth(a.text+"…")<n||(a.text=a.text.slice(0,a.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+"…"))}getStrokeScaleEnabled(){return!0}}Lde.prototype._fillFunc=function(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)},Lde.prototype._strokeFunc=function(e){e.strokeText(this._partialText,this._partialTextX,this._partialTextY)},Lde.prototype.className="Text",Lde.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],Yle(Lde),pse.overWriteSetter(Lde,"width",lse()),pse.overWriteSetter(Lde,"height",lse()),pse.addGetterSetter(Lde,"fontFamily","Arial"),pse.addGetterSetter(Lde,"fontSize",12,cse()),pse.addGetterSetter(Lde,"fontStyle",Mde),pse.addGetterSetter(Lde,"fontVariant",Mde),pse.addGetterSetter(Lde,"padding",0,cse()),pse.addGetterSetter(Lde,"align",gde),pse.addGetterSetter(Lde,"verticalAlign","top"),pse.addGetterSetter(Lde,"lineHeight",1,cse()),pse.addGetterSetter(Lde,"wrap","word"),pse.addGetterSetter(Lde,"ellipsis",!1,dse()),pse.addGetterSetter(Lde,"letterSpacing",0,cse()),pse.addGetterSetter(Lde,"text","",sse()),pse.addGetterSetter(Lde,"textDecoration","");var kde="normal";function wde(e){e.fillText(this.partialText,0,0)}function Sde(e){e.strokeText(this.partialText,0,0)}class xde extends xhe{constructor(e){super(e),this.dummyCanvas=rse.createCanvasElement(),this.dataArray=[],this.dataArray=Khe.parsePathData(this.attrs.data),this.on("dataChange.konva",(function(){this.dataArray=Khe.parsePathData(this.attrs.data),this._setTextData()})),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var t=this.textDecoration(),n=this.fill(),r=this.fontSize(),a=this.glyphInfo;"underline"===t&&e.beginPath();for(var o=0;o<a.length;o++){e.save();var c=a[o].p0;e.translate(c.x,c.y),e.rotate(a[o].rotation),this.partialText=a[o].text,e.fillStrokeShape(this),"underline"===t&&(0===o&&e.moveTo(0,r/2+1),e.lineTo(r,r/2+1)),e.restore()}"underline"===t&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),e.restore()}_hitFunc(e){e.beginPath();var t=this.glyphInfo;if(t.length>=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var r=0;r<t.length;r++){var a=t[r].p1;e.lineTo(a.x,a.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return rse.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Lde.prototype.setText.call(this,e)}_getContextFont(){return Lde.prototype._getContextFont.call(this)}_getTextSize(e){var t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();var n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(this.attrs.fontSize,10)}}_setTextData(){var e=this,t=this._getTextSize(this.attrs.text),n=this.letterSpacing(),r=this.align(),a=this.kerningFunc();this.textWidth=t.width,this.textHeight=t.height;var o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);this.glyphInfo=[];for(var c=0,i=0;i<e.dataArray.length;i++)e.dataArray[i].pathLength>0&&(c+=e.dataArray[i].pathLength);var l=0;"center"===r&&(l=Math.max(0,c/2-o/2)),"right"===r&&(l=Math.max(0,c-o));for(var s,h,d,u=pde(this.text()),m=this.text().split(" ").length-1,p=-1,v=0,f=function(){v=0;for(var t=e.dataArray,n=p+1;n<t.length;n++){if(t[n].pathLength>0)return p=n,t[n];"M"===t[n].command&&(s={x:t[n].points[0],y:t[n].points[1]})}return{}},z=function(t){var a=e._getTextSize(t).width+n;" "===t&&"justify"===r&&(a+=(c-o)/m);var i=0,l=0;for(h=void 0;Math.abs(a-i)/a>.01&&l<20;){l++;for(var u=i;void 0===d;)(d=f())&&u+d.pathLength<a&&(u+=d.pathLength,d=void 0);if(0===Object.keys(d).length||void 0===s)return;var p=!1;switch(d.command){case"L":Khe.getLineLength(s.x,s.y,d.points[0],d.points[1])>a?h=Khe.getPointOnLine(a,s.x,s.y,d.points[0],d.points[1],s.x,s.y):d=void 0;break;case"A":var z=d.points[4],g=d.points[5],y=d.points[4]+g;0===v?v=z+1e-8:a>i?v+=Math.PI/180*g/Math.abs(g):v-=Math.PI/360*g/Math.abs(g),(g<0&&v<y||g>=0&&v>y)&&(v=y,p=!0),h=Khe.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],v,d.points[6]);break;case"C":0===v?v=a>d.pathLength?1e-8:a/d.pathLength:a>i?v+=(a-i)/d.pathLength/2:v=Math.max(v-(i-a)/d.pathLength/2,0),v>1&&(v=1,p=!0),h=Khe.getPointOnCubicBezier(v,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3],d.points[4],d.points[5]);break;case"Q":0===v?v=a/d.pathLength:a>i?v+=(a-i)/d.pathLength:v-=(i-a)/d.pathLength,v>1&&(v=1,p=!0),h=Khe.getPointOnQuadraticBezier(v,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3])}void 0!==h&&(i=Khe.getLineLength(s.x,s.y,h.x,h.y)),p&&(p=!1,d=void 0)}},g=l/(e._getTextSize("C").width+n)-1,y=0;y<g&&(z("C"),void 0!==s&&void 0!==h);y++)s=h;for(var M=0;M<u.length&&(z(u[M]),void 0!==s&&void 0!==h);M++){var E=Khe.getLineLength(s.x,s.y,h.x,h.y),b=0;if(a)try{b=a(u[M-1],u[M])*this.fontSize()}catch(e){b=0}s.x+=b,h.x+=b,this.textWidth+=b;var H=Khe.getPointOnLine(b+E/2,s.x,s.y,h.x,h.y),V=Math.atan2(h.y-s.y,h.x-s.x);this.glyphInfo.push({transposeX:H.x,transposeY:H.y,text:u[M],rotation:V,p0:s,p1:h}),s=h}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var e=[];this.glyphInfo.forEach((function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)}));for(var t,n,r=e[0]||0,a=e[0]||0,o=e[1]||0,c=e[1]||0,i=0;i<e.length/2;i++)t=e[2*i],n=e[2*i+1],r=Math.min(r,t),a=Math.max(a,t),o=Math.min(o,n),c=Math.max(c,n);var l=this.fontSize();return{x:r-l/2,y:o-l/2,width:a-r+l,height:c-o+l}}destroy(){return rse.releaseCanvas(this.dummyCanvas),super.destroy()}}xde.prototype._fillFunc=wde,xde.prototype._strokeFunc=Sde,xde.prototype._fillFuncHit=wde,xde.prototype._strokeFuncHit=Sde,xde.prototype.className="TextPath",xde.prototype._attrsAffectingSize=["text","fontSize","data"],Yle(xde),pse.addGetterSetter(xde,"data"),pse.addGetterSetter(xde,"fontFamily","Arial"),pse.addGetterSetter(xde,"fontSize",12,cse()),pse.addGetterSetter(xde,"fontStyle",kde),pse.addGetterSetter(xde,"align","left"),pse.addGetterSetter(xde,"letterSpacing",0,cse()),pse.addGetterSetter(xde,"textBaseline","middle"),pse.addGetterSetter(xde,"fontVariant",kde),pse.addGetterSetter(xde,"text",""),pse.addGetterSetter(xde,"textDecoration",null),pse.addGetterSetter(xde,"kerningFunc",null);var Tde="tr-konva",Ode=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange"].map((e=>e+`.${Tde}`)).join(" "),Ade="nodesRect",Rde=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Nde={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const _de="ontouchstart"in Gle._global;var Dde=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function Pde(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),a=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:a})}class Fde extends Nhe{constructor(e){super(e),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Ode,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return rse.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Tde+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter((e=>!e.isAncestorOf(this)||(rse.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1)));return this._nodes=e=t,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((e=>{const t=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=e._attrsAffectingSize.map((e=>e+"Change."+this._getEventNamespace())).join(" ");e.on(n,t),e.on(Rde.map((e=>e+`.${this._getEventNamespace()}`)).join(" "),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)})),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,(n=>{t=e.getAbsolutePosition(),this.isDragging()||e===this.findOne(".back")||this.startDrag(n,!1)})),e.on(`dragmove.${this._getEventNamespace()}`,(n=>{if(!t)return;const r=e.getAbsolutePosition(),a=r.x-t.x,o=r.y-t.y;this.nodes().forEach((t=>{if(t===e)return;if(t.isDragging())return;const r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+a,y:r.y+o}),t.startDrag(n)})),t=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((e=>{e.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Ade),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Ade,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){var r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(n),o=e.getAbsolutePosition(n),c=r.x*a.x-e.offsetX()*a.x,i=r.y*a.y-e.offsetY()*a.y;const l=(Gle.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return Pde({x:o.x+c*Math.cos(l)+i*Math.sin(-l),y:o.y+i*Math.cos(l)+c*Math.sin(l),width:r.width*a.x,height:r.height*a.y,rotation:l},-Gle.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map((t=>{const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],a=t.getAbsoluteTransform();r.forEach((function(t){var n=a.point(t);e.push(n)}))}));const t=new Kle;var n,r,a,o;t.rotate(-Gle.getAngle(this.rotation())),e.forEach((function(e){var c=t.point(e);void 0===n&&(n=a=c.x,r=o=c.y),n=Math.min(n,c.x),r=Math.min(r,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)})),t.invert();const c=t.point({x:n,y:r});return{x:c.x,y:c.y,width:a-n,height:o-r,rotation:Gle.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Dde.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var t=new lde({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:_de?10:"auto"}),n=this;t.on("mousedown touchstart",(function(e){n._handleMouseDown(e)})),t.on("dragstart",(e=>{t.stopDrag(),e.cancelBubble=!0})),t.on("dragend",(e=>{e.cancelBubble=!0})),t.on("mouseenter",(()=>{var n=Gle.getAngle(this.rotation()),r=function(e,t){if("rotater"===e)return"crosshair";t+=rse.degToRad(Nde[e]||0);var n=(rse.radToDeg(t)%360+360)%360;return rse._inRange(n,337.5,360)||rse._inRange(n,0,22.5)?"ns-resize":rse._inRange(n,22.5,67.5)?"nesw-resize":rse._inRange(n,67.5,112.5)?"ew-resize":rse._inRange(n,112.5,157.5)?"nwse-resize":rse._inRange(n,157.5,202.5)?"ns-resize":rse._inRange(n,202.5,247.5)?"nesw-resize":rse._inRange(n,247.5,292.5)?"ew-resize":rse._inRange(n,292.5,337.5)?"nwse-resize":(rse.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(e,n);t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0})),t.on("mouseout",(()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(t)}_createBack(){var e=new xhe({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var t=this.getParent(),n=t.padding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),t.rotateEnabled()&&e.lineTo(this.width()/2,-t.rotateAnchorOffset()*rse._sign(this.height())-n),e.fillStrokeShape(this)},hitFunc:(e,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+2*n,t.height()+2*n),e.fillStrokeShape(t)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",(e=>{e.cancelBubble=!0})),e.on("dragmove",(e=>{e.cancelBubble=!0})),e.on("dragend",(e=>{e.cancelBubble=!0})),this.on("dragmove",(e=>{this.update()}))}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,r=t.height,a=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/a),this.cos=Math.abs(n/a),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var o=e.target.getAbsolutePosition(),c=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:c.x-o.x,y:c.y-o.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach((t=>{t._fire("transformstart",{evt:e.evt,target:t})}))}_handleMouseMove(e){var t,n,r,a=this.findOne("."+this._movingAnchorName),o=a.getStage();o.setPointersPositions(e);const c=o.getPointerPosition();let i={x:c.x-this._anchorDragOffset.x,y:c.y-this._anchorDragOffset.y};const l=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(i=this.anchorDragBoundFunc()(l,i,e)),a.setAbsolutePosition(i);const s=a.getAbsolutePosition();if(l.x!==s.x||l.y!==s.y)if("rotater"!==this._movingAnchorName){var h=this.keepRatio()||e.shiftKey,d=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(h){var u=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(u.x-a.x(),2)+Math.pow(u.y-a.y(),2));var m=this.findOne(".top-left").x()>u.x?-1:1,p=this.findOne(".top-left").y()>u.y?-1:1;t=r*this.cos*m,n=r*this.sin*p,this.findOne(".top-left").x(u.x-t),this.findOne(".top-left").y(u.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(a.y());else if("top-right"===this._movingAnchorName){h&&(u=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()},r=Math.sqrt(Math.pow(a.x()-u.x,2)+Math.pow(u.y-a.y(),2)),m=this.findOne(".top-right").x()<u.x?-1:1,p=this.findOne(".top-right").y()>u.y?-1:1,t=r*this.cos*m,n=r*this.sin*p,this.findOne(".top-right").x(u.x+t),this.findOne(".top-right").y(u.y-n));var v=a.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else"middle-left"===this._movingAnchorName?this.findOne(".top-left").x(a.x()):"middle-right"===this._movingAnchorName?this.findOne(".bottom-right").x(a.x()):"bottom-left"===this._movingAnchorName?(h&&(u=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()},r=Math.sqrt(Math.pow(u.x-a.x(),2)+Math.pow(a.y()-u.y,2)),m=u.x<a.x()?-1:1,p=a.y()<u.y?-1:1,t=r*this.cos*m,n=r*this.sin*p,a.x(u.x-t),a.y(u.y+n)),v=a.position(),this.findOne(".top-left").x(v.x),this.findOne(".bottom-right").y(v.y)):"bottom-center"===this._movingAnchorName?this.findOne(".bottom-right").y(a.y()):"bottom-right"===this._movingAnchorName?h&&(u=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()},r=Math.sqrt(Math.pow(a.x()-u.x,2)+Math.pow(a.y()-u.y,2)),m=this.findOne(".bottom-right").x()<u.x?-1:1,p=this.findOne(".bottom-right").y()<u.y?-1:1,t=r*this.cos*m,n=r*this.sin*p,this.findOne(".bottom-right").x(u.x+t),this.findOne(".bottom-right").y(u.y+n)):console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(d=this.centeredScaling()||e.altKey){var f=this.findOne(".top-left"),z=this.findOne(".bottom-right"),g=f.x(),y=f.y(),M=this.getWidth()-z.x(),E=this.getHeight()-z.y();z.move({x:-g,y:-y}),f.move({x:M,y:E})}var b=this.findOne(".top-left").getAbsolutePosition();t=b.x,n=b.y;var H=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),V=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:H,height:V,rotation:Gle.getAngle(this.rotation())},e)}else{var C=this._getNodeRect();t=a.x()-C.width/2,n=-a.y()+C.height/2;let r=Math.atan2(-n,t)+Math.PI/2;C.height<0&&(r-=Math.PI);const o=Gle.getAngle(this.rotation())+r,c=Gle.getAngle(this.rotationSnapTolerance()),i=function(e,t){const n=function(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}(e);return Pde(e,t,n)}(C,function(e,t,n){let r=t;for(let a=0;a<e.length;a++){const o=Gle.getAngle(e[a]),c=Math.abs(o-t)%(2*Math.PI);Math.min(c,2*Math.PI-c)<n&&(r=o)}return r}(this.rotationSnaps(),o,c)-C.rotation);this._fitNodesInto(i,e)}}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var t=this.getNode();this._fire("transformend",{evt:e,target:t}),t&&this._nodes.forEach((t=>{t._fire("transformend",{evt:e,target:t})})),this._movingAnchorName=null}}_fitNodesInto(e,t){var n=this._getNodeRect();if(rse._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(rse._inRange(e.height,2*-this.padding()-1,1))return void this.update();const r=this.flipEnabled();var a=new Kle;if(a.rotate(Gle.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=a.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!r)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=a.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!r)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=a.point({x:0,y:2*-this.padding()});if(e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=a.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!r)return void this.update()}if(this.boundBoxFunc()){const t=this.boundBoxFunc()(n,e);t?e=t:rse.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,c=new Kle;c.translate(n.x,n.y),c.rotate(n.rotation),c.scale(n.width/o,n.height/o);const i=new Kle;i.translate(e.x,e.y),i.rotate(e.rotation),i.scale(e.width/o,e.height/o);const l=i.multiply(c.invert());this._nodes.forEach((e=>{var n;const r=e.getParent().getAbsoluteTransform(),a=e.getTransform().copy();a.translate(e.offsetX(),e.offsetY());const o=new Kle;o.multiply(r.copy().invert()).multiply(l).multiply(r).multiply(a);const c=o.decompose();e.setAttrs(c),this._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()})),this.rotation(rse._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e,t=this._getNodeRect();this.rotation(rse._getRotation(t.rotation));var n=t.width,r=t.height,a=this.enabledAnchors(),o=this.resizeEnabled(),c=this.padding(),i=this.anchorSize();this.find("._anchor").forEach((e=>{e.setAttrs({width:i,height:i,offsetX:i/2,offsetY:i/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:i/2+c,offsetY:i/2+c,visible:o&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:i/2+c,visible:o&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:i/2-c,offsetY:i/2+c,visible:o&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:i/2+c,visible:o&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:i/2-c,visible:o&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:i/2+c,offsetY:i/2-c,visible:o&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:i/2-c,visible:o&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:i/2-c,offsetY:i/2-c,visible:o&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*rse._sign(r)-c,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Nhe.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Fse.prototype.toObject.call(this)}clone(e){return Fse.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Fde.prototype.className="Transformer",Yle(Fde),pse.addGetterSetter(Fde,"enabledAnchors",Dde,(function(e){return e instanceof Array||rse.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===Dde.indexOf(e)&&rse.warn("Unknown anchor name: "+e+". Available names are: "+Dde.join(", "))})),e||[]})),pse.addGetterSetter(Fde,"flipEnabled",!0,dse()),pse.addGetterSetter(Fde,"resizeEnabled",!0),pse.addGetterSetter(Fde,"anchorSize",10,cse()),pse.addGetterSetter(Fde,"rotateEnabled",!0),pse.addGetterSetter(Fde,"rotationSnaps",[]),pse.addGetterSetter(Fde,"rotateAnchorOffset",50,cse()),pse.addGetterSetter(Fde,"rotationSnapTolerance",5,cse()),pse.addGetterSetter(Fde,"borderEnabled",!0),pse.addGetterSetter(Fde,"anchorStroke","rgb(0, 161, 255)"),pse.addGetterSetter(Fde,"anchorStrokeWidth",1,cse()),pse.addGetterSetter(Fde,"anchorFill","white"),pse.addGetterSetter(Fde,"anchorCornerRadius",0,cse()),pse.addGetterSetter(Fde,"borderStroke","rgb(0, 161, 255)"),pse.addGetterSetter(Fde,"borderStrokeWidth",1,cse()),pse.addGetterSetter(Fde,"borderDash"),pse.addGetterSetter(Fde,"keepRatio",!0),pse.addGetterSetter(Fde,"centeredScaling",!1),pse.addGetterSetter(Fde,"ignoreStroke",!1),pse.addGetterSetter(Fde,"padding",0,cse()),pse.addGetterSetter(Fde,"node"),pse.addGetterSetter(Fde,"nodes"),pse.addGetterSetter(Fde,"boundBoxFunc"),pse.addGetterSetter(Fde,"anchorDragBoundFunc"),pse.addGetterSetter(Fde,"shouldOverdrawWholeArea",!1),pse.addGetterSetter(Fde,"useSingleNodeRotation",!0),pse.backCompat(Fde,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class Ide extends xhe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Gle.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}function Bde(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}Ide.prototype.className="Wedge",Ide.prototype._centroid=!0,Ide.prototype._attrsAffectingSize=["radius"],Yle(Ide),pse.addGetterSetter(Ide,"radius",0,cse()),pse.addGetterSetter(Ide,"angle",0,cse()),pse.addGetterSetter(Ide,"clockwise",!1),pse.backCompat(Ide,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var jde=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Ude=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Wde(e,t,n,r,a){var o=n-t,c=a-r;return 0===o?r+c/2:0===c?r:c*((e-t)/o)+r}function $de(e,t,n){var r=4*(n*e.width+t),a=[];return a.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),a}function qde(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}function Gde(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}pse.addGetterSetter(Fse,"blurRadius",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"brightness",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"contrast",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"embossStrength",.5,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"embossWhiteLevel",.5,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"embossDirection","top-left",null,pse.afterSetFilter),pse.addGetterSetter(Fse,"embossBlend",!1,null,pse.afterSetFilter),pse.addGetterSetter(Fse,"enhance",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"hue",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"saturation",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"luminance",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"hue",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"saturation",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"value",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"kaleidoscopePower",2,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"kaleidoscopeAngle",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"threshold",0,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"noise",.2,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"pixelSize",8,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"levels",.5,cse(),pse.afterSetFilter),pse.addGetterSetter(Fse,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),pse.addGetterSetter(Fse,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),pse.addGetterSetter(Fse,"blue",0,ose,pse.afterSetFilter),pse.addGetterSetter(Fse,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),pse.addGetterSetter(Fse,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),pse.addGetterSetter(Fse,"blue",0,ose,pse.afterSetFilter),pse.addGetterSetter(Fse,"alpha",1,(function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e})),pse.addGetterSetter(Fse,"threshold",.5,cse(),pse.afterSetFilter),Whe.Util._assign(Whe,{Arc:$he,Arrow:Xhe,Circle:Qhe,Ellipse:Jhe,Image:Zhe,Label:cde,Tag:ide,Line:Yhe,Path:Khe,Rect:lde,RegularPolygon:sde,Ring:dde,Sprite:ude,Star:mde,Text:Lde,TextPath:xde,Transformer:Fde,Wedge:Ide,Filters:{Blur:function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,r,a,o,c,i,l,s,h,d,u,m,p,v,f,z,g,y,M,E,b,H,V,C,L=e.data,k=e.width,w=e.height,S=t+t+1,x=k-1,T=w-1,O=t+1,A=O*(O+1)/2,R=new Bde,N=null,_=R,D=null,P=null,F=jde[t],I=Ude[t];for(a=1;a<S;a++)_=_.next=new Bde,a===O&&(N=_);for(_.next=R,l=i=0,r=0;r<w;r++){for(z=g=y=M=s=h=d=u=0,m=O*(E=L[i]),p=O*(b=L[i+1]),v=O*(H=L[i+2]),f=O*(V=L[i+3]),s+=A*E,h+=A*b,d+=A*H,u+=A*V,_=R,a=0;a<O;a++)_.r=E,_.g=b,_.b=H,_.a=V,_=_.next;for(a=1;a<O;a++)o=i+((x<a?x:a)<<2),s+=(_.r=E=L[o])*(C=O-a),h+=(_.g=b=L[o+1])*C,d+=(_.b=H=L[o+2])*C,u+=(_.a=V=L[o+3])*C,z+=E,g+=b,y+=H,M+=V,_=_.next;for(D=R,P=N,n=0;n<k;n++)L[i+3]=V=u*F>>I,0!==V?(V=255/V,L[i]=(s*F>>I)*V,L[i+1]=(h*F>>I)*V,L[i+2]=(d*F>>I)*V):L[i]=L[i+1]=L[i+2]=0,s-=m,h-=p,d-=v,u-=f,m-=D.r,p-=D.g,v-=D.b,f-=D.a,o=l+((o=n+t+1)<x?o:x)<<2,s+=z+=D.r=L[o],h+=g+=D.g=L[o+1],d+=y+=D.b=L[o+2],u+=M+=D.a=L[o+3],D=D.next,m+=E=P.r,p+=b=P.g,v+=H=P.b,f+=V=P.a,z-=E,g-=b,y-=H,M-=V,P=P.next,i+=4;l+=k}for(n=0;n<k;n++){for(g=y=M=z=h=d=u=s=0,m=O*(E=L[i=n<<2]),p=O*(b=L[i+1]),v=O*(H=L[i+2]),f=O*(V=L[i+3]),s+=A*E,h+=A*b,d+=A*H,u+=A*V,_=R,a=0;a<O;a++)_.r=E,_.g=b,_.b=H,_.a=V,_=_.next;for(c=k,a=1;a<=t;a++)i=c+n<<2,s+=(_.r=E=L[i])*(C=O-a),h+=(_.g=b=L[i+1])*C,d+=(_.b=H=L[i+2])*C,u+=(_.a=V=L[i+3])*C,z+=E,g+=b,y+=H,M+=V,_=_.next,a<T&&(c+=k);for(i=n,D=R,P=N,r=0;r<w;r++)L[3+(o=i<<2)]=V=u*F>>I,V>0?(V=255/V,L[o]=(s*F>>I)*V,L[o+1]=(h*F>>I)*V,L[o+2]=(d*F>>I)*V):L[o]=L[o+1]=L[o+2]=0,s-=m,h-=p,d-=v,u-=f,m-=D.r,p-=D.g,v-=D.b,f-=D.a,o=n+((o=r+O)<T?o:T)*k<<2,s+=z+=D.r=L[o],h+=g+=D.g=L[o+1],d+=y+=D.b=L[o+2],u+=M+=D.a=L[o+3],D=D.next,m+=E=P.r,p+=b=P.g,v+=H=P.b,f+=V=P.a,z-=E,g-=b,y-=H,M-=V,P=P.next,i+=k}}(e,t)},Brighten:function(e){var t,n=255*this.brightness(),r=e.data,a=r.length;for(t=0;t<a;t+=4)r[t]+=n,r[t+1]+=n,r[t+2]+=n},Contrast:function(e){var t,n=Math.pow((this.contrast()+100)/100,2),r=e.data,a=r.length,o=150,c=150,i=150;for(t=0;t<a;t+=4)o=r[t],c=r[t+1],i=r[t+2],o/=255,o-=.5,o*=n,o+=.5,c/=255,c-=.5,c*=n,c+=.5,i/=255,i-=.5,i*=n,i+=.5,o=(o*=255)<0?0:o>255?255:o,c=(c*=255)<0?0:c>255?255:c,i=(i*=255)<0?0:i>255?255:i,r[t]=o,r[t+1]=c,r[t+2]=i},Emboss:function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),a=this.embossBlend(),o=0,c=0,i=e.data,l=e.width,s=e.height,h=4*l,d=s;switch(r){case"top-left":o=-1,c=-1;break;case"top":o=-1,c=0;break;case"top-right":o=-1,c=1;break;case"right":o=0,c=1;break;case"bottom-right":o=1,c=1;break;case"bottom":o=1,c=0;break;case"bottom-left":o=1,c=-1;break;case"left":o=0,c=-1;break;default:rse.error("Unknown emboss direction: "+r)}do{var u=(d-1)*h,m=o;d+m<1&&(m=0),d+m>s&&(m=0);var p=(d-1+m)*l*4,v=l;do{var f=u+4*(v-1),z=c;v+z<1&&(z=0),v+z>l&&(z=0);var g=p+4*(v-1+z),y=i[f]-i[g],M=i[f+1]-i[g+1],E=i[f+2]-i[g+2],b=y,H=b>0?b:-b;if((M>0?M:-M)>H&&(b=M),(E>0?E:-E)>H&&(b=E),b*=t,a){var V=i[f]+b,C=i[f+1]+b,L=i[f+2]+b;i[f]=V>255?255:V<0?0:V,i[f+1]=C>255?255:C<0?0:C,i[f+2]=L>255?255:L<0?0:L}else{var k=n-b;k<0?k=0:k>255&&(k=255),i[f]=i[f+1]=i[f+2]=k}}while(--v)}while(--d)},Enhance:function(e){var t,n,r,a,o=e.data,c=o.length,i=o[0],l=i,s=o[1],h=s,d=o[2],u=d,m=this.enhance();if(0!==m){for(a=0;a<c;a+=4)(t=o[a+0])<i?i=t:t>l&&(l=t),(n=o[a+1])<s?s=n:n>h&&(h=n),(r=o[a+2])<d?d=r:r>u&&(u=r);var p,v,f,z,g,y,M,E,b;for(l===i&&(l=255,i=0),h===s&&(h=255,s=0),u===d&&(u=255,d=0),m>0?(v=l+m*(255-l),f=i-m*(i-0),g=h+m*(255-h),y=s-m*(s-0),E=u+m*(255-u),b=d-m*(d-0)):(v=l+m*(l-(p=.5*(l+i))),f=i+m*(i-p),g=h+m*(h-(z=.5*(h+s))),y=s+m*(s-z),E=u+m*(u-(M=.5*(u+d))),b=d+m*(d-M)),a=0;a<c;a+=4)o[a+0]=Wde(o[a+0],i,l,f,v),o[a+1]=Wde(o[a+1],s,h,y,g),o[a+2]=Wde(o[a+2],d,u,b,E)}},Grayscale:function(e){var t,n,r=e.data,a=r.length;for(t=0;t<a;t+=4)n=.34*r[t]+.5*r[t+1]+.16*r[t+2],r[t]=n,r[t+1]=n,r[t+2]=n},HSL:function(e){var t,n,r,a,o,c=e.data,i=c.length,l=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,h=127*this.luminance(),d=1*l*Math.cos(s*Math.PI/180),u=1*l*Math.sin(s*Math.PI/180),m=.299+.701*d+.167*u,p=.587-.587*d+.33*u,v=.114-.114*d-.497*u,f=.299-.299*d-.328*u,z=.587+.413*d+.035*u,g=.114-.114*d+.293*u,y=.299-.3*d+1.25*u,M=.587-.586*d-1.05*u,E=.114+.886*d-.2*u;for(t=0;t<i;t+=4)n=c[t+0],r=c[t+1],a=c[t+2],o=c[t+3],c[t+0]=m*n+p*r+v*a+h,c[t+1]=f*n+z*r+g*a+h,c[t+2]=y*n+M*r+E*a+h,c[t+3]=o},HSV:function(e){var t,n,r,a,o,c=e.data,i=c.length,l=Math.pow(2,this.value()),s=Math.pow(2,this.saturation()),h=Math.abs(this.hue()+360)%360,d=l*s*Math.cos(h*Math.PI/180),u=l*s*Math.sin(h*Math.PI/180),m=.299*l+.701*d+.167*u,p=.587*l-.587*d+.33*u,v=.114*l-.114*d-.497*u,f=.299*l-.299*d-.328*u,z=.587*l+.413*d+.035*u,g=.114*l-.114*d+.293*u,y=.299*l-.3*d+1.25*u,M=.587*l-.586*d-1.05*u,E=.114*l+.886*d-.2*u;for(t=0;t<i;t+=4)n=c[t+0],r=c[t+1],a=c[t+2],o=c[t+3],c[t+0]=m*n+p*r+v*a,c[t+1]=f*n+z*r+g*a,c[t+2]=y*n+M*r+E*a,c[t+3]=o},Invert:function(e){var t,n=e.data,r=n.length;for(t=0;t<r;t+=4)n[t]=255-n[t],n[t+1]=255-n[t+1],n[t+2]=255-n[t+2]},Kaleidoscope:function(e){var t,n,r,a,o,c,i,l,s,h=e.width,d=e.height,u=Math.round(this.kaleidoscopePower()),m=Math.round(this.kaleidoscopeAngle()),p=Math.floor(h*(m%360)/360);if(!(u<1)){var v=rse.createCanvasElement();v.width=h,v.height=d;var f=v.getContext("2d").getImageData(0,0,h,d);rse.releaseCanvas(v),function(e,t,n){var r,a,o,c,i=e.data,l=t.data,s=e.width,h=e.height,d=n.polarCenterX||s/2,u=n.polarCenterY||h/2,m=0,p=0,v=0,f=0,z=Math.sqrt(d*d+u*u);a=s-d,o=h-u,z=(c=Math.sqrt(a*a+o*o))>z?c:z;var g,y,M,E,b=h,H=s,V=360/H*Math.PI/180;for(y=0;y<H;y+=1)for(M=Math.sin(y*V),E=Math.cos(y*V),g=0;g<b;g+=1)a=Math.floor(d+z*g/b*E),m=i[0+(r=4*((o=Math.floor(u+z*g/b*M))*s+a))],p=i[r+1],v=i[r+2],f=i[r+3],l[0+(r=4*(y+g*s))]=m,l[r+1]=p,l[r+2]=v,l[r+3]=f}(e,f,{polarCenterX:h/2,polarCenterY:d/2});for(var z=h/Math.pow(2,u);z<=8;)z*=2,u-=1;var g=z=Math.ceil(z),y=0,M=g,E=1;for(p+z>h&&(y=g,M=0,E=-1),n=0;n<d;n+=1)for(t=y;t!==M;t+=E)l=4*(h*n+Math.round(t+p)%h),a=f.data[l+0],o=f.data[l+1],c=f.data[l+2],i=f.data[l+3],s=4*(h*n+t),f.data[s+0]=a,f.data[s+1]=o,f.data[s+2]=c,f.data[s+3]=i;for(n=0;n<d;n+=1)for(g=Math.floor(z),r=0;r<u;r+=1){for(t=0;t<g+1;t+=1)l=4*(h*n+t),a=f.data[l+0],o=f.data[l+1],c=f.data[l+2],i=f.data[l+3],s=4*(h*n+2*g-t-1),f.data[s+0]=a,f.data[s+1]=o,f.data[s+2]=c,f.data[s+3]=i;g*=2}!function(e,t,n){var r,a,o,c,i,l,s=e.data,h=t.data,d=e.width,u=e.height,m=n.polarCenterX||d/2,p=n.polarCenterY||u/2,v=0,f=0,z=0,g=0,y=Math.sqrt(m*m+p*p);a=d-m,o=u-p,y=(l=Math.sqrt(a*a+o*o))>y?l:y;var M,E,b,H=u,V=d,C=n.polarRotation||0;for(a=0;a<d;a+=1)for(o=0;o<u;o+=1)c=a-m,i=o-p,M=Math.sqrt(c*c+i*i)*H/y,E=(E=(180*Math.atan2(i,c)/Math.PI+360+C)%360)*V/360,b=Math.floor(E),v=s[0+(r=4*(Math.floor(M)*d+b))],f=s[r+1],z=s[r+2],g=s[r+3],h[0+(r=4*(o*d+a))]=v,h[r+1]=f,h[r+2]=z,h[r+3]=g}(f,e,{polarRotation:0})}},Mask:function(e){var t=function(e,t){var n=$de(e,0,0),r=$de(e,e.width-1,0),a=$de(e,0,e.height-1),o=$de(e,e.width-1,e.height-1),c=t||10;if(qde(n,r)<c&&qde(r,o)<c&&qde(o,a)<c&&qde(a,n)<c){for(var i=function(e){for(var t=[0,0,0],n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}([r,n,o,a]),l=[],s=0;s<e.width*e.height;s++){var h=qde(i,[e.data[4*s],e.data[4*s+1],e.data[4*s+2]]);l[s]=h<c?0:255}return l}}(e,this.threshold());return t&&function(e,t){for(var n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}(e,t=function(e,t,n){for(var r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),c=[],i=0;i<n;i++)for(var l=0;l<t;l++){for(var s=i*t+l,h=0,d=0;d<a;d++)for(var u=0;u<a;u++){var m=i+d-o,p=l+u-o;if(m>=0&&m<n&&p>=0&&p<t){var v=r[d*a+u];h+=e[m*t+p]*v}}c[s]=h}return c}(t=function(e,t,n){for(var r=[1,1,1,1,1,1,1,1,1],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),c=[],i=0;i<n;i++)for(var l=0;l<t;l++){for(var s=i*t+l,h=0,d=0;d<a;d++)for(var u=0;u<a;u++){var m=i+d-o,p=l+u-o;if(m>=0&&m<n&&p>=0&&p<t){var v=r[d*a+u];h+=e[m*t+p]*v}}c[s]=h>=1020?255:0}return c}(t=function(e,t,n){for(var r=[1,1,1,1,0,1,1,1,1],a=Math.round(Math.sqrt(r.length)),o=Math.floor(a/2),c=[],i=0;i<n;i++)for(var l=0;l<t;l++){for(var s=i*t+l,h=0,d=0;d<a;d++)for(var u=0;u<a;u++){var m=i+d-o,p=l+u-o;if(m>=0&&m<n&&p>=0&&p<t){var v=r[d*a+u];h+=e[m*t+p]*v}}c[s]=2040===h?255:0}return c}(t,e.width,e.height),e.width,e.height),e.width,e.height)),e},Noise:function(e){var t,n=255*this.noise(),r=e.data,a=r.length,o=n/2;for(t=0;t<a;t+=4)r[t+0]+=o-2*o*Math.random(),r[t+1]+=o-2*o*Math.random(),r[t+2]+=o-2*o*Math.random()},Pixelate:function(e){var t,n,r,a,o,c,i,l,s,h,d,u,m,p,v=Math.ceil(this.pixelSize()),f=e.width,z=e.height,g=Math.ceil(f/v),y=Math.ceil(z/v),M=e.data;if(v<=0)rse.error("pixelSize value can not be <= 0");else for(u=0;u<g;u+=1)for(m=0;m<y;m+=1){for(a=0,o=0,c=0,i=0,s=(l=u*v)+v,d=(h=m*v)+v,p=0,t=l;t<s;t+=1)if(!(t>=f))for(n=h;n<d;n+=1)n>=z||(a+=M[0+(r=4*(f*n+t))],o+=M[r+1],c+=M[r+2],i+=M[r+3],p+=1);for(a/=p,o/=p,c/=p,i/=p,t=l;t<s;t+=1)if(!(t>=f))for(n=h;n<d;n+=1)n>=z||(M[0+(r=4*(f*n+t))]=a,M[r+1]=o,M[r+2]=c,M[r+3]=i)}},Posterize:function(e){var t,n=Math.round(254*this.levels())+1,r=e.data,a=r.length,o=255/n;for(t=0;t<a;t+=1)r[t]=Math.floor(r[t]/o)*o},RGB:function(e){var t,n,r=e.data,a=r.length,o=this.red(),c=this.green(),i=this.blue();for(t=0;t<a;t+=4)n=(.34*r[t]+.5*r[t+1]+.16*r[t+2])/255,r[t]=n*o,r[t+1]=n*c,r[t+2]=n*i,r[t+3]=r[t+3]},RGBA:function(e){var t,n,r=e.data,a=r.length,o=this.red(),c=this.green(),i=this.blue(),l=this.alpha();for(t=0;t<a;t+=4)n=1-l,r[t]=o*l+r[t]*n,r[t+1]=c*l+r[t+1]*n,r[t+2]=i*l+r[t+2]*n},Sepia:function(e){var t,n,r,a,o=e.data,c=o.length;for(t=0;t<c;t+=4)n=o[t+0],r=o[t+1],a=o[t+2],o[t+0]=Math.min(255,.393*n+.769*r+.189*a),o[t+1]=Math.min(255,.349*n+.686*r+.168*a),o[t+2]=Math.min(255,.272*n+.534*r+.131*a)},Solarize:function(e){var t=e.data,n=e.width,r=4*n,a=e.height;do{var o=(a-1)*r,c=n;do{var i=o+4*(c-1),l=t[i],s=t[i+1],h=t[i+2];l>127&&(l=255-l),s>127&&(s=255-s),h>127&&(h=255-h),t[i]=l,t[i+1]=s,t[i+2]=h}while(--c)}while(--a)},Threshold:function(e){var t,n=255*this.threshold(),r=e.data,a=r.length;for(t=0;t<a;t+=1)r[t]=r[t]<n?0:255}}});var Yde,Kde,Xde={exports:{}},Qde={exports:{}};function Jde(){if(Kde)return Yde;Kde=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return Yde=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,a){for(var o,c,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),l=1;l<arguments.length;l++){for(var s in o=Object(arguments[l]))t.call(o,s)&&(i[s]=o[s]);if(e){c=e(o);for(var h=0;h<c.length;h++)n.call(o,c[h])&&(i[c[h]]=o[c[h]])}}return i},Yde}var Zde,eue,tue,nue,rue={exports:{}},aue={},oue={};function cue(){return tue||(tue=1,"production"===bee.env.NODE_ENV?rue.exports=(Zde||(Zde=1,function(e){var t,n,r,a;if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,i=c.now();e.unstable_now=function(){return c.now()-i}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var l=null,s=null,h=function(){if(null!==l)try{var t=e.unstable_now();l(!0,t),l=null}catch(e){throw setTimeout(h,0),e}};t=function(e){null!==l?setTimeout(t,0,e):(l=e,setTimeout(h,0))},n=function(e,t){s=setTimeout(e,t)},r=function(){clearTimeout(s)},e.unstable_shouldYield=function(){return!1},a=e.unstable_forceFrameRate=function(){}}else{var d=window.setTimeout,u=window.clearTimeout;if("undefined"!=typeof console){var m=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof m&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var p=!1,v=null,f=-1,z=5,g=0;e.unstable_shouldYield=function(){return e.unstable_now()>=g},a=function(){},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<e?Math.floor(1e3/e):5};var y=new MessageChannel,M=y.port2;y.port1.onmessage=function(){if(null!==v){var t=e.unstable_now();g=t+z;try{v(!0,t)?M.postMessage(null):(p=!1,v=null)}catch(e){throw M.postMessage(null),e}}else p=!1},t=function(e){v=e,p||(p=!0,M.postMessage(null))},n=function(t,n){f=d((function(){t(e.unstable_now())}),n)},r=function(){u(f),f=-1}}function E(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,a=e[r];if(!(void 0!==a&&0<V(a,t)))break e;e[r]=t,e[n]=a,n=r}}function b(e){return void 0===(e=e[0])?null:e}function H(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,a=e.length;r<a;){var o=2*(r+1)-1,c=e[o],i=o+1,l=e[i];if(void 0!==c&&0>V(c,n))void 0!==l&&0>V(l,c)?(e[r]=l,e[i]=n,r=i):(e[r]=c,e[o]=n,r=o);else{if(!(void 0!==l&&0>V(l,n)))break e;e[r]=l,e[i]=n,r=i}}}return t}return null}function V(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var C=[],L=[],k=1,w=null,S=3,x=!1,T=!1,O=!1;function A(e){for(var t=b(L);null!==t;){if(null===t.callback)H(L);else{if(!(t.startTime<=e))break;H(L),t.sortIndex=t.expirationTime,E(C,t)}t=b(L)}}function R(e){if(O=!1,A(e),!T)if(null!==b(C))T=!0,t(N);else{var r=b(L);null!==r&&n(R,r.startTime-e)}}function N(t,a){T=!1,O&&(O=!1,r()),x=!0;var o=S;try{for(A(a),w=b(C);null!==w&&(!(w.expirationTime>a)||t&&!e.unstable_shouldYield());){var c=w.callback;if("function"==typeof c){w.callback=null,S=w.priorityLevel;var i=c(w.expirationTime<=a);a=e.unstable_now(),"function"==typeof i?w.callback=i:w===b(C)&&H(C),A(a)}else H(C);w=b(C)}if(null!==w)var l=!0;else{var s=b(L);null!==s&&n(R,s.startTime-a),l=!1}return l}finally{w=null,S=o,x=!1}}var _=a;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){T||x||(T=!0,t(N))},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_getFirstCallbackNode=function(){return b(C)},e.unstable_next=function(e){switch(S){case 1:case 2:case 3:var t=3;break;default:t=S}var n=S;S=t;try{return e()}finally{S=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=_,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=S;S=e;try{return t()}finally{S=n}},e.unstable_scheduleCallback=function(a,o,c){var i=e.unstable_now();switch(c="object"==typeof c&&null!==c&&"number"==typeof(c=c.delay)&&0<c?i+c:i,a){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return a={id:k++,callback:o,priorityLevel:a,startTime:c,expirationTime:l=c+l,sortIndex:-1},c>i?(a.sortIndex=c,E(L,a),null===b(C)&&a===b(L)&&(O?r():O=!0,n(R,c-i))):(a.sortIndex=l,E(C,a),T||x||(T=!0,t(N))),a},e.unstable_wrapCallback=function(e){var t=S;return function(){var n=S;S=t;try{return e.apply(this,arguments)}finally{S=n}}}}(aue)),aue):rue.exports=function(){return eue||(eue=1,e=oue,"production"!==bee.env.NODE_ENV&&function(){var t,n,r,a;if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,i=c.now();e.unstable_now=function(){return c.now()-i}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var l=null,s=null,h=function(){if(null!==l)try{var t=e.unstable_now();l(!0,t),l=null}catch(e){throw setTimeout(h,0),e}};t=function(e){null!==l?setTimeout(t,0,e):(l=e,setTimeout(h,0))},n=function(e,t){s=setTimeout(e,t)},r=function(){clearTimeout(s)},e.unstable_shouldYield=function(){return!1},a=e.unstable_forceFrameRate=function(){}}else{var d=window.setTimeout,u=window.clearTimeout;if("undefined"!=typeof console){var m=window.requestAnimationFrame,p=window.cancelAnimationFrame;"function"!=typeof m&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var v=!1,f=null,z=-1,g=5,y=0;e.unstable_shouldYield=function(){return e.unstable_now()>=y},a=function(){},e.unstable_forceFrameRate=function(e){e<0||e>125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):g=e>0?Math.floor(1e3/e):5};var M=new MessageChannel,E=M.port2;M.port1.onmessage=function(){if(null!==f){var t=e.unstable_now();y=t+g;try{f(!0,t)?E.postMessage(null):(v=!1,f=null)}catch(e){throw E.postMessage(null),e}}else v=!1},t=function(e){f=e,v||(v=!0,E.postMessage(null))},n=function(t,n){z=d((function(){t(e.unstable_now())}),n)},r=function(){u(z),z=-1}}function b(e,t){var n=e.length;e.push(t),function(e,t,n){for(var r=n;;){var a=r-1>>>1,o=e[a];if(!(void 0!==o&&C(o,t)>0))return;e[a]=t,e[r]=o,r=a}}(e,t,n)}function H(e){var t=e[0];return void 0===t?null:t}function V(e){var t=e[0];if(void 0!==t){var n=e.pop();return n!==t&&(e[0]=n,function(e,t){for(var n=0,r=e.length;n<r;){var a=2*(n+1)-1,o=e[a],c=a+1,i=e[c];if(void 0!==o&&C(o,t)<0)void 0!==i&&C(i,o)<0?(e[n]=i,e[c]=t,n=c):(e[n]=o,e[a]=t,n=a);else{if(!(void 0!==i&&C(i,t)<0))return;e[n]=i,e[c]=t,n=c}}}(e,n)),t}return null}function C(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var L=[],k=[],w=1,S=null,x=3,T=!1,O=!1,A=!1;function R(e){for(var t=H(k);null!==t;){if(null===t.callback)V(k);else{if(!(t.startTime<=e))return;V(k),t.sortIndex=t.expirationTime,b(L,t)}t=H(k)}}function N(e){if(A=!1,R(e),!O)if(null!==H(L))O=!0,t(_);else{var r=H(k);null!==r&&n(N,r.startTime-e)}}function _(t,a){O=!1,A&&(A=!1,r()),T=!0;var o=x;try{return function(t,r){var a=r;for(R(a),S=H(L);null!==S&&(!(S.expirationTime>a)||t&&!e.unstable_shouldYield());){var o=S.callback;if("function"==typeof o){S.callback=null,x=S.priorityLevel;var c=o(S.expirationTime<=a);a=e.unstable_now(),"function"==typeof c?S.callback=c:S===H(L)&&V(L),R(a)}else V(L);S=H(L)}if(null!==S)return!0;var i=H(k);return null!==i&&n(N,i.startTime-a),!1}(t,a)}finally{S=null,x=o,T=!1}}var D=a;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){O||T||(O=!0,t(_))},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return H(L)},e.unstable_next=function(e){var t;switch(x){case 1:case 2:case 3:t=3;break;default:t=x}var n=x;x=t;try{return e()}finally{x=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=D,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=x;x=e;try{return t()}finally{x=n}},e.unstable_scheduleCallback=function(a,o,c){var i,l,s=e.unstable_now();if("object"==typeof c&&null!==c){var h=c.delay;i="number"==typeof h&&h>0?s+h:s}else i=s;switch(a){case 1:l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}var d=i+l,u={id:w++,callback:o,priorityLevel:a,startTime:i,expirationTime:d,sortIndex:-1};return i>s?(u.sortIndex=i,b(k,u),null===H(L)&&u===H(k)&&(A?r():A=!0,n(N,i-s))):(u.sortIndex=d,b(L,u),O||T||(O=!0,t(_))),u},e.unstable_wrapCallback=function(e){var t=x;return function(){var n=x;x=t;try{return e.apply(this,arguments)}finally{x=n}}}}()),oue;var e}()),rue.exports}
302
302
  /** @license React v0.26.2
303
303
  * react-reconciler.production.min.js
304
304
  *