voxnix 1.0.21 → 1.0.22
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/voxnix.iife.js +102 -102
- package/dist/voxnix.js +1239 -1201
- package/dist/voxnix.umd.cjs +43 -43
- package/package.json +1 -1
package/dist/voxnix.umd.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}body{background-color:transparent;--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-2{top:.5rem;right:.5rem;bottom:.5rem;left:.5rem}.-right-0\\.5{right:-.125rem}.-right-1{right:-.25rem}.-top-0\\.5{top:-.125rem}.-top-1{top:-.25rem}.bottom-6{bottom:1.5rem}.bottom-full{bottom:100%}.left-1\\/2{left:50%}.left-3{left:.75rem}.right-0{right:0}.right-3{right:.75rem}.top-3{top:.75rem}.top-6{top:1.5rem}.z-10{z-index:10}.z-50{z-index:50}.z-\\[9999\\]{z-index:9999}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-1\\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-6{margin-bottom:1.5rem}.ml-auto{margin-left:auto}.mt-1{margin-top:.25rem}.mt-1\\.5{margin-top:.375rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-1\\.5{height:.375rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-20{height:5rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-9{height:2.25rem}.h-\\[18px\\]{height:18px}.h-px{height:1px}.min-h-\\[280px\\]{min-height:280px}.min-h-\\[300px\\]{min-height:300px}.min-h-\\[44px\\]{min-height:44px}.min-h-\\[56px\\]{min-height:56px}.w-1\\.5{width:.375rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-20{width:5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-9{width:2.25rem}.w-\\[18px\\]{width:18px}.w-\\[360px\\]{width:360px}.w-full{width:100%}.max-w-\\[220px\\]{max-width:220px}.max-w-\\[260px\\]{max-width:260px}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.origin-bottom-left{transform-origin:bottom left}.origin-bottom-right{transform-origin:bottom right}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-2\\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-7{gap:1.75rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.whitespace-nowrap{white-space:nowrap}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-50{--tw-border-opacity: 1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1))}.border-green-100{--tw-border-opacity: 1;border-color:rgb(220 252 231 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-primary{--tw-border-opacity: 1;border-color:rgb(63 49 146 / var(--tw-border-opacity, 1))}.border-primary\\/15{border-color:#3f319226}.border-primary\\/20{border-color:#3f319233}.border-red-100{--tw-border-opacity: 1;border-color:rgb(254 226 226 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-white\\/30{border-color:#ffffff4d}.border-t-gray-600{--tw-border-opacity: 1;border-top-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-t-primary{--tw-border-opacity: 1;border-top-color:rgb(63 49 146 / var(--tw-border-opacity, 1))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-50\\/60{background-color:#f9fafb99}.bg-gray-50\\/70{background-color:#f9fafbb3}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\\/15{background-color:#22c55e26}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(63 49 146 / var(--tw-bg-opacity, 1))}.bg-primary\\/10{background-color:#3f31921a}.bg-primary\\/15{background-color:#3f319226}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\\/15{background-color:#ef444426}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/90{background-color:#ffffffe6}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-\\[\\#3f3192\\]{--tw-gradient-from: #3f3192 var(--tw-gradient-from-position);--tw-gradient-to: rgb(63 49 146 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-\\[\\#5240c2\\]{--tw-gradient-to: #5240c2 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.fill-white{fill:#fff}.p-1{padding:.25rem}.p-1\\.5{padding:.375rem}.p-6{padding:1.5rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2\\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pt-1{padding-top:.25rem}.pt-5{padding-top:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[22px\\]{font-size:22px}.text-\\[28px\\]{font-size:28px}.text-\\[9px\\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\\[0\\.12em\\]{letter-spacing:.12em}.tracking-\\[0\\.18em\\]{letter-spacing:.18em}.tracking-\\[0\\.25em\\]{letter-spacing:.25em}.tracking-\\[0\\.2em\\]{letter-spacing:.2em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(63 49 146 / var(--tw-text-opacity, 1))}.text-primary\\/70{color:#3f3192b3}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\\/50{color:#ffffff80}.opacity-75{opacity:.75}.shadow-\\[0_20px_60px_rgba\\(0\\,0\\,0\\,0\\.18\\)\\,0_4px_16px_rgba\\(0\\,0\\,0\\,0\\.08\\)\\]{--tw-shadow: 0 20px 60px rgba(0,0,0,.18),0 4px 16px rgba(0,0,0,.08);--tw-shadow-colored: 0 20px 60px var(--tw-shadow-color), 0 4px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_2px_6px_rgba\\(0\\,0\\,0\\,0\\.07\\)\\]{--tw-shadow: 0 2px 6px rgba(0,0,0,.07);--tw-shadow-colored: 0 2px 6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_2px_8px_rgba\\(239\\,68\\,68\\,0\\.35\\)\\]{--tw-shadow: 0 2px 8px rgba(239,68,68,.35);--tw-shadow-colored: 0 2px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_2px_8px_rgba\\(63\\,49\\,146\\,0\\.35\\)\\]{--tw-shadow: 0 2px 8px rgba(63,49,146,.35);--tw-shadow-colored: 0 2px 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_4px_14px_rgba\\(239\\,68\\,68\\,0\\.4\\)\\]{--tw-shadow: 0 4px 14px rgba(239,68,68,.4);--tw-shadow-colored: 0 4px 14px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_4px_14px_rgba\\(34\\,197\\,94\\,0\\.4\\)\\]{--tw-shadow: 0 4px 14px rgba(34,197,94,.4);--tw-shadow-colored: 0 4px 14px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-primary\\/30{--tw-shadow-color: rgb(63 49 146 / .3);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}@keyframes fadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}@keyframes slideUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.animate-fadeIn{animation:fadeIn .25s cubic-bezier(.16,1,.3,1) forwards}.animate-slideUp{animation:slideUp .3s cubic-bezier(.16,1,.3,1) forwards}.placeholder\\:text-2xl::-moz-placeholder{font-size:1.5rem;line-height:2rem}.placeholder\\:text-2xl::placeholder{font-size:1.5rem;line-height:2rem}.placeholder\\:font-normal::-moz-placeholder{font-weight:400}.placeholder\\:font-normal::placeholder{font-weight:400}.placeholder\\:text-gray-300::-moz-placeholder{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.placeholder\\:text-gray-300::placeholder{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.last\\:border-0:last-child{border-width:0px}.hover\\:border-primary\\/20:hover{border-color:#3f319233}.hover\\:bg-amber-50:hover{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\\:bg-green-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.hover\\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.hover\\:bg-primary-hover:hover{--tw-bg-opacity: 1;background-color:rgb(43 32 102 / var(--tw-bg-opacity, 1))}.hover\\:bg-primary\\/5:hover{background-color:#3f31920d}.hover\\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\\:from-green-600:hover{--tw-gradient-from: #16a34a var(--tw-gradient-from-position);--tw-gradient-to: rgb(22 163 74 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\\:to-green-700:hover{--tw-gradient-to: #15803d var(--tw-gradient-to-position)}.hover\\:text-amber-800:hover{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.hover\\:text-gray-500:hover{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.hover\\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\\:text-green-800:hover{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.hover\\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\\:shadow-\\[0_4px_12px_rgba\\(63\\,49\\,146\\,0\\.13\\)\\]:hover{--tw-shadow: 0 4px 12px rgba(63,49,146,.13);--tw-shadow-colored: 0 4px 12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:shadow-\\[0_6px_18px_rgba\\(239\\,68\\,68\\,0\\.5\\)\\]:hover{--tw-shadow: 0 6px 18px rgba(239,68,68,.5);--tw-shadow-colored: 0 6px 18px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:shadow-\\[0_6px_20px_rgba\\(239\\,68\\,68\\,0\\.5\\)\\]:hover{--tw-shadow: 0 6px 20px rgba(239,68,68,.5);--tw-shadow-colored: 0 6px 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:shadow-\\[0_6px_20px_rgba\\(34\\,197\\,94\\,0\\.5\\)\\]:hover{--tw-shadow: 0 6px 20px rgba(34,197,94,.5);--tw-shadow-colored: 0 6px 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\\:border-primary:focus{--tw-border-opacity: 1;border-color:rgb(63 49 146 / var(--tw-border-opacity, 1))}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-primary:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(63 49 146 / var(--tw-ring-opacity, 1))}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\\:bg-primary\\/10:active{background-color:#3f31921a}.active\\:shadow-none:active{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:from-gray-200:disabled{--tw-gradient-from: #e5e7eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(229 231 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.disabled\\:to-gray-200:disabled{--tw-gradient-to: #e5e7eb var(--tw-gradient-to-position)}.disabled\\:text-gray-400:disabled{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.disabled\\:opacity-40:disabled{opacity:.4}.disabled\\:opacity-50:disabled{opacity:.5}.disabled\\:opacity-60:disabled{opacity:.6}.disabled\\:shadow-none:disabled{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}')),document.head.appendChild(t)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
2
|
-
(function(Yt,se){typeof exports=="object"&&typeof module<"u"?se(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],se):(Yt=typeof globalThis<"u"?globalThis:Yt||self,se(Yt.OmnixWidget={},Yt.React,Yt.ReactDOM))})(this,function(Yt,se,Uo){"use strict";function Lo(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const
|
|
2
|
+
(function(Yt,se){typeof exports=="object"&&typeof module<"u"?se(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],se):(Yt=typeof globalThis<"u"?globalThis:Yt||self,se(Yt.OmnixWidget={},Yt.React,Yt.ReactDOM))})(this,function(Yt,se,Uo){"use strict";function Lo(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const Pr=Lo(Uo);var ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Wo(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),t}var zs={exports:{}},$r={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Fn;function Go(){if(Fn)return $r;Fn=1;var r=se,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function a(o,d,c){var l,g={},
|
|
10
|
+
*/var Fn;function Go(){if(Fn)return $r;Fn=1;var r=se,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function a(o,d,c){var l,g={},f=null,w=null;c!==void 0&&(f=""+c),d.key!==void 0&&(f=""+d.key),d.ref!==void 0&&(w=d.ref);for(l in d)s.call(d,l)&&!n.hasOwnProperty(l)&&(g[l]=d[l]);if(o&&o.defaultProps)for(l in d=o.defaultProps,d)g[l]===void 0&&(g[l]=d[l]);return{$$typeof:e,type:o,key:f,ref:w,props:g,_owner:i.current}}return $r.Fragment=t,$r.jsx=a,$r.jsxs=a,$r}var Nr={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react-jsx-runtime.development.js
|
|
13
13
|
*
|
|
@@ -15,20 +15,20 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var kn;function Vo(){return kn||(kn=1,process.env.NODE_ENV!=="production"&&function(){var r=se,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),
|
|
19
|
-
`+ke+D}}var
|
|
18
|
+
*/var kn;function Vo(){return kn||(kn=1,process.env.NODE_ENV!=="production"&&function(){var r=se,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),y=Symbol.iterator,b="@@iterator";function C(D){if(D===null||typeof D!="object")return null;var N=y&&D[y]||D[b];return typeof N=="function"?N:null}var x=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(D){{for(var N=arguments.length,Z=new Array(N>1?N-1:0),te=1;te<N;te++)Z[te-1]=arguments[te];E("error",D,Z)}}function E(D,N,Z){{var te=x.ReactDebugCurrentFrame,ve=te.getStackAddendum();ve!==""&&(N+="%s",Z=Z.concat([ve]));var be=Z.map(function(de){return String(de)});be.unshift("Warning: "+N),Function.prototype.apply.call(console[D],console,be)}}var _=!1,R=!1,T=!1,F=!1,h=!1,O;O=Symbol.for("react.module.reference");function A(D){return!!(typeof D=="string"||typeof D=="function"||D===s||D===n||h||D===i||D===c||D===l||F||D===w||_||R||T||typeof D=="object"&&D!==null&&(D.$$typeof===f||D.$$typeof===g||D.$$typeof===a||D.$$typeof===o||D.$$typeof===d||D.$$typeof===O||D.getModuleId!==void 0))}function u(D,N,Z){var te=D.displayName;if(te)return te;var ve=N.displayName||N.name||"";return ve!==""?Z+"("+ve+")":Z}function v(D){return D.displayName||"Context"}function m(D){if(D==null)return null;if(typeof D.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof D=="function")return D.displayName||D.name||null;if(typeof D=="string")return D;switch(D){case s:return"Fragment";case t:return"Portal";case n:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case l:return"SuspenseList"}if(typeof D=="object")switch(D.$$typeof){case o:var N=D;return v(N)+".Consumer";case a:var Z=D;return v(Z._context)+".Provider";case d:return u(D,D.render,"ForwardRef");case g:var te=D.displayName||null;return te!==null?te:m(D.type)||"Memo";case f:{var ve=D,be=ve._payload,de=ve._init;try{return m(de(be))}catch{return null}}}return null}var U=Object.assign,j=0,J,V,ne,he,ue,I,P;function $(){}$.__reactDisabledLog=!0;function H(){{if(j===0){J=console.log,V=console.info,ne=console.warn,he=console.error,ue=console.group,I=console.groupCollapsed,P=console.groupEnd;var D={configurable:!0,enumerable:!0,value:$,writable:!0};Object.defineProperties(console,{info:D,log:D,warn:D,error:D,group:D,groupCollapsed:D,groupEnd:D})}j++}}function we(){{if(j--,j===0){var D={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:U({},D,{value:J}),info:U({},D,{value:V}),warn:U({},D,{value:ne}),error:U({},D,{value:he}),group:U({},D,{value:ue}),groupCollapsed:U({},D,{value:I}),groupEnd:U({},D,{value:P})})}j<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=x.ReactCurrentDispatcher,ke;function q(D,N,Z){{if(ke===void 0)try{throw Error()}catch(ve){var te=ve.stack.trim().match(/\n( *(at )?)/);ke=te&&te[1]||""}return`
|
|
19
|
+
`+ke+D}}var G=!1,Ee;{var ct=typeof WeakMap=="function"?WeakMap:Map;Ee=new ct}function pt(D,N){if(!D||G)return"";{var Z=Ee.get(D);if(Z!==void 0)return Z}var te;G=!0;var ve=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var be;be=pe.current,pe.current=null,H();try{if(N){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(Je){te=Je}Reflect.construct(D,[],de)}else{try{de.call()}catch(Je){te=Je}D.call(de.prototype)}}else{try{throw Error()}catch(Je){te=Je}D()}}catch(Je){if(Je&&te&&typeof Je.stack=="string"){for(var oe=Je.stack.split(`
|
|
20
20
|
`),Ve=te.stack.split(`
|
|
21
21
|
`),Re=oe.length-1,Be=Ve.length-1;Re>=1&&Be>=0&&oe[Re]!==Ve[Be];)Be--;for(;Re>=1&&Be>=0;Re--,Be--)if(oe[Re]!==Ve[Be]){if(Re!==1||Be!==1)do if(Re--,Be--,Be<0||oe[Re]!==Ve[Be]){var dt=`
|
|
22
|
-
`+oe[Re].replace(" at new "," at ");return D.displayName&&dt.includes("<anonymous>")&&(dt=dt.replace("<anonymous>",D.displayName)),typeof D=="function"&&Ee.set(D,dt),dt}while(Re>=1&&Be>=0);break}}}finally{
|
|
22
|
+
`+oe[Re].replace(" at new "," at ");return D.displayName&&dt.includes("<anonymous>")&&(dt=dt.replace("<anonymous>",D.displayName)),typeof D=="function"&&Ee.set(D,dt),dt}while(Re>=1&&Be>=0);break}}}finally{G=!1,pe.current=be,we(),Error.prepareStackTrace=ve}var Hr=D?D.displayName||D.name:"",pr=Hr?q(Hr):"";return typeof D=="function"&&Ee.set(D,pr),pr}function Ye(D,N,Z){return pt(D,!1)}function Me(D){var N=D.prototype;return!!(N&&N.isReactComponent)}function lt(D,N,Z){if(D==null)return"";if(typeof D=="function")return pt(D,Me(D));if(typeof D=="string")return q(D);switch(D){case c:return q("Suspense");case l:return q("SuspenseList")}if(typeof D=="object")switch(D.$$typeof){case d:return Ye(D.render);case g:return lt(D.type,N,Z);case f:{var te=D,ve=te._payload,be=te._init;try{return lt(be(ve),N,Z)}catch{}}}return""}var Xe=Object.prototype.hasOwnProperty,Tt={},mt=x.ReactDebugCurrentFrame;function vt(D){if(D){var N=D._owner,Z=lt(D.type,D._source,N?N.type:null);mt.setExtraStackFrame(Z)}else mt.setExtraStackFrame(null)}function gr(D,N,Z,te,ve){{var be=Function.call.bind(Xe);for(var de in D)if(be(D,de)){var oe=void 0;try{if(typeof D[de]!="function"){var Ve=Error((te||"React class")+": "+Z+" type `"+de+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof D[de]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ve.name="Invariant Violation",Ve}oe=D[de](N,de,te,Z,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Re){oe=Re}oe&&!(oe instanceof Error)&&(vt(ve),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",te||"React class",Z,de,typeof oe),vt(null)),oe instanceof Error&&!(oe.message in Tt)&&(Tt[oe.message]=!0,vt(ve),p("Failed %s type: %s",Z,oe.message),vt(null))}}}var rt=Array.isArray;function We(D){return rt(D)}function Rt(D){{var N=typeof Symbol=="function"&&Symbol.toStringTag,Z=N&&D[Symbol.toStringTag]||D.constructor.name||"Object";return Z}}function kr(D){try{return ts(D),!1}catch{return!0}}function ts(D){return""+D}function Ut(D){if(kr(D))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Rt(D)),ts(D)}var tr=x.ReactCurrentOwner,bn={key:!0,ref:!0,__self:!0,__source:!0},rs,ss;function rr(D){if(Xe.call(D,"ref")){var N=Object.getOwnPropertyDescriptor(D,"ref").get;if(N&&N.isReactWarning)return!1}return D.ref!==void 0}function xr(D){if(Xe.call(D,"key")){var N=Object.getOwnPropertyDescriptor(D,"key").get;if(N&&N.isReactWarning)return!1}return D.key!==void 0}function Cn(D,N){typeof D.ref=="string"&&tr.current}function Os(D,N){{var Z=function(){rs||(rs=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",N))};Z.isReactWarning=!0,Object.defineProperty(D,"key",{get:Z,configurable:!0})}}function Ms(D,N){{var Z=function(){ss||(ss=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",N))};Z.isReactWarning=!0,Object.defineProperty(D,"ref",{get:Z,configurable:!0})}}var _n=function(D,N,Z,te,ve,be,de){var oe={$$typeof:e,type:D,key:N,ref:Z,props:de,_owner:be};return oe._store={},Object.defineProperty(oe._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(oe,"_self",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.defineProperty(oe,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ve}),Object.freeze&&(Object.freeze(oe.props),Object.freeze(oe)),oe};function Dn(D,N,Z,te,ve){{var be,de={},oe=null,Ve=null;Z!==void 0&&(Ut(Z),oe=""+Z),xr(N)&&(Ut(N.key),oe=""+N.key),rr(N)&&(Ve=N.ref,Cn(N,ve));for(be in N)Xe.call(N,be)&&!bn.hasOwnProperty(be)&&(de[be]=N[be]);if(D&&D.defaultProps){var Re=D.defaultProps;for(be in Re)de[be]===void 0&&(de[be]=Re[be])}if(oe||Ve){var Be=typeof D=="function"?D.displayName||D.name||"Unknown":D;oe&&Os(de,Be),Ve&&Ms(de,Be)}return _n(D,oe,Ve,ve,te,tr.current,de)}}var Br=x.ReactCurrentOwner,js=x.ReactDebugCurrentFrame;function Lt(D){if(D){var N=D._owner,Z=lt(D.type,D._source,N?N.type:null);js.setExtraStackFrame(Z)}else js.setExtraStackFrame(null)}var is;is=!1;function Ir(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function qs(){{if(Br.current){var D=m(Br.current.type);if(D)return`
|
|
23
23
|
|
|
24
|
-
Check the render method of \``+D+"`."}return""}}function An(D){return""}var Us={};function Ls(D){{var N=qs();if(!N){var
|
|
24
|
+
Check the render method of \``+D+"`."}return""}}function An(D){return""}var Us={};function Ls(D){{var N=qs();if(!N){var Z=typeof D=="string"?D:D.displayName||D.name;Z&&(N=`
|
|
25
25
|
|
|
26
|
-
Check the top-level render call using <`+
|
|
26
|
+
Check the top-level render call using <`+Z+">.")}return N}}function Ys(D,N){{if(!D._store||D._store.validated||D.key!=null)return;D._store.validated=!0;var Z=Ls(N);if(Us[Z])return;Us[Z]=!0;var te="";D&&D._owner&&D._owner!==Br.current&&(te=" It was passed a child from "+m(D._owner.type)+"."),Lt(D),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Z,te),Lt(null)}}function Ws(D,N){{if(typeof D!="object")return;if(We(D))for(var Z=0;Z<D.length;Z++){var te=D[Z];Ir(te)&&Ys(te,N)}else if(Ir(D))D._store&&(D._store.validated=!0);else if(D){var ve=C(D);if(typeof ve=="function"&&ve!==D.entries)for(var be=ve.call(D),de;!(de=be.next()).done;)Ir(de.value)&&Ys(de.value,N)}}}function Gs(D){{var N=D.type;if(N==null||typeof N=="string")return;var Z;if(typeof N=="function")Z=N.propTypes;else if(typeof N=="object"&&(N.$$typeof===d||N.$$typeof===g))Z=N.propTypes;else return;if(Z){var te=m(N);gr(Z,D.props,"prop",te,D)}else if(N.PropTypes!==void 0&&!is){is=!0;var ve=m(N);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ve||"Unknown")}typeof N.getDefaultProps=="function"&&!N.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Sn(D){{for(var N=Object.keys(D.props),Z=0;Z<N.length;Z++){var te=N[Z];if(te!=="children"&&te!=="key"){Lt(D),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),Lt(null);break}}D.ref!==null&&(Lt(D),p("Invalid attribute `ref` supplied to `React.Fragment`."),Lt(null))}}var ns={};function Ge(D,N,Z,te,ve,be){{var de=A(D);if(!de){var oe="";(D===void 0||typeof D=="object"&&D!==null&&Object.keys(D).length===0)&&(oe+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ve=An();Ve?oe+=Ve:oe+=qs();var Re;D===null?Re="null":We(D)?Re="array":D!==void 0&&D.$$typeof===e?(Re="<"+(m(D.type)||"Unknown")+" />",oe=" Did you accidentally export a JSX literal instead of a component?"):Re=typeof D,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Re,oe)}var Be=Dn(D,N,Z,ve,be);if(Be==null)return Be;if(de){var dt=N.children;if(dt!==void 0)if(te)if(We(dt)){for(var Hr=0;Hr<dt.length;Hr++)Ws(dt[Hr],D);Object.freeze&&Object.freeze(dt)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ws(dt,D)}if(Xe.call(N,"key")){var pr=m(D),Je=Object.keys(N).filter(function(Fu){return Fu!=="key"}),Rn=Je.length>0?"{key: someKey, "+Je.join(": ..., ")+": ...}":"{key: someKey}";if(!ns[pr+Rn]){var Ru=Je.length>0?"{"+Je.join(": ..., ")+": ...}":"{}";p(`A props object containing a "key" prop is being spread into JSX:
|
|
27
27
|
let props = %s;
|
|
28
28
|
<%s {...props} />
|
|
29
29
|
React keys must be passed directly to JSX without using spread:
|
|
30
30
|
let props = %s;
|
|
31
|
-
<%s key={someKey} {...props} />`,Rn,pr,Ru,pr),ns[pr+Rn]=!0}}return D===s?Sn(Be):Gs(Be),Be}}function Ft(D,N,
|
|
31
|
+
<%s key={someKey} {...props} />`,Rn,pr,Ru,pr),ns[pr+Rn]=!0}}return D===s?Sn(Be):Gs(Be),Be}}function Ft(D,N,Z){return Ge(D,N,Z,!0)}function Vs(D,N,Z){return Ge(D,N,Z,!1)}var Tn=Vs,Tu=Ft;Nr.Fragment=s,Nr.jsx=Tn,Nr.jsxs=Tu}()),Nr}process.env.NODE_ENV==="production"?zs.exports=Go():zs.exports=Vo();var S=zs.exports;/**
|
|
32
32
|
* @license lucide-react v0.344.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
@@ -38,87 +38,87 @@ React keys must be passed directly to JSX without using spread:
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const Ko=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),
|
|
41
|
+
*/const Ko=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),qe=(r,e)=>{const t=se.forwardRef(({color:s="currentColor",size:i=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o="",children:d,...c},l)=>se.createElement("svg",{ref:l,...zo,width:i,height:i,stroke:s,strokeWidth:a?Number(n)*24/Number(i):n,className:["lucide",`lucide-${Ko(r)}`,o].join(" "),...c},[...e.map(([g,f])=>se.createElement(g,f)),...Array.isArray(d)?d:[d]]));return t.displayName=`${r}`,t};/**
|
|
42
42
|
* @license lucide-react v0.344.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const Zo=
|
|
46
|
+
*/const Zo=qe("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
47
47
|
* @license lucide-react v0.344.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const Bn=
|
|
51
|
+
*/const Bn=qe("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
52
52
|
* @license lucide-react v0.344.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const Xo=
|
|
56
|
+
*/const Xo=qe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
57
57
|
* @license lucide-react v0.344.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const Jo=
|
|
61
|
+
*/const Jo=qe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
62
62
|
* @license lucide-react v0.344.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const In=
|
|
66
|
+
*/const In=qe("Coffee",[["path",{d:"M17 8h1a4 4 0 1 1 0 8h-1",key:"jx4kbh"}],["path",{d:"M3 8h14v9a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4Z",key:"1bxrl0"}],["line",{x1:"6",x2:"6",y1:"2",y2:"4",key:"1cr9l3"}],["line",{x1:"10",x2:"10",y1:"2",y2:"4",key:"170wym"}],["line",{x1:"14",x2:"14",y1:"2",y2:"4",key:"1c5f70"}]]);/**
|
|
67
67
|
* @license lucide-react v0.344.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const Qo=
|
|
71
|
+
*/const Qo=qe("Delete",[["path",{d:"M20 5H9l-7 7 7 7h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2Z",key:"1oy587"}],["line",{x1:"18",x2:"12",y1:"9",y2:"15",key:"1olkx5"}],["line",{x1:"12",x2:"18",y1:"9",y2:"15",key:"1n50pc"}]]);/**
|
|
72
72
|
* @license lucide-react v0.344.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const e0=
|
|
76
|
+
*/const e0=qe("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
77
77
|
* @license lucide-react v0.344.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const t0=
|
|
81
|
+
*/const t0=qe("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
82
82
|
* @license lucide-react v0.344.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const r0=
|
|
86
|
+
*/const r0=qe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
87
87
|
* @license lucide-react v0.344.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const Hn=qe("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
|
|
92
92
|
* @license lucide-react v0.344.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const s0=
|
|
96
|
+
*/const s0=qe("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/**
|
|
97
97
|
* @license lucide-react v0.344.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const as=
|
|
101
|
+
*/const as=qe("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/**
|
|
102
102
|
* @license lucide-react v0.344.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const Or=
|
|
106
|
+
*/const Or=qe("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
|
|
107
107
|
* @license lucide-react v0.344.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const i0=
|
|
111
|
+
*/const i0=qe("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
|
|
112
112
|
* @license lucide-react v0.344.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
116
|
+
*/const Pn=qe("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
117
117
|
* @license lucide-react v0.344.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
120
120
|
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const n0=
|
|
121
|
+
*/const n0=qe("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),a0=[{n:"1",l:""},{n:"2",l:"ABC"},{n:"3",l:"DEF"},{n:"4",l:"GHI"},{n:"5",l:"JKL"},{n:"6",l:"MNO"},{n:"7",l:"PQRS"},{n:"8",l:"TUV"},{n:"9",l:"WXYZ"},{n:"*",l:""},{n:"0",l:"+"},{n:"#",l:""}],$n=({onKeyPress:r})=>S.jsx("div",{className:"grid grid-cols-3 gap-2.5 w-full px-5 py-2",children:a0.map(({n:e,l:t})=>S.jsxs("button",{onClick:()=>r(e),className:`
|
|
122
122
|
relative flex flex-col items-center justify-center
|
|
123
123
|
h-16 rounded-2xl select-none
|
|
124
124
|
bg-white border border-gray-100
|
|
@@ -127,7 +127,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
127
127
|
hover:border-primary/20 hover:bg-primary/5
|
|
128
128
|
active:shadow-none active:bg-primary/10 active:scale-95
|
|
129
129
|
transition-all duration-150
|
|
130
|
-
`,children:[S.jsx("span",{className:"text-[22px] font-medium text-gray-800 leading-none",children:e}),t?S.jsx("span",{className:"text-[9px] text-gray-400 font-semibold tracking-[0.18em] mt-1.5",children:t}):S.jsx("span",{className:"h-3.5"})]},e))});class o0{constructor(){this.listeners={}}on(e,t){return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t),()=>this.off(e,t)}off(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(s=>s!==t))}emitLocal(e,t){this.listeners[e]&&this.listeners[e].forEach(s=>{try{s(t)}catch(i){console.error(`Error in event listener for ${e}:`,i)}})}emitToParent(e,t){this.emitLocal(e,t)}}const V=new o0;var Nn={exports:{}};function c0(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ks={exports:{}};const l0=Wo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var On;function ce(){return On||(On=1,function(r,e){(function(t,s){r.exports=s()})(ie,function(){var t=t||function(s,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof ie<"u"&&ie.crypto&&(n=ie.crypto),!n&&typeof c0=="function")try{n=l0}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(E){var _;return p.prototype=E,_=new p,p.prototype=null,_}}(),d={},c=d.lib={},l=c.Base=function(){return{extend:function(p){var E=o(this);return p&&E.mixIn(p),(!E.hasOwnProperty("init")||this.init===E.init)&&(E.init=function(){E.$super.init.apply(this,arguments)}),E.init.prototype=E,E.$super=this,E},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var E in p)p.hasOwnProperty(E)&&(this[E]=p[E]);p.hasOwnProperty("toString")&&(this.toString=p.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=c.WordArray=l.extend({init:function(p,E){p=this.words=p||[],E!=i?this.sigBytes=E:this.sigBytes=p.length*4},toString:function(p){return(p||y).stringify(this)},concat:function(p){var E=this.words,_=p.words,R=this.sigBytes,T=p.sigBytes;if(this.clamp(),R%4)for(var F=0;F<T;F++){var h=_[F>>>2]>>>24-F%4*8&255;E[R+F>>>2]|=h<<24-(R+F)%4*8}else for(var O=0;O<T;O+=4)E[R+O>>>2]=_[O>>>2];return this.sigBytes+=T,this},clamp:function(){var p=this.words,E=this.sigBytes;p[E>>>2]&=4294967295<<32-E%4*8,p.length=s.ceil(E/4)},clone:function(){var p=l.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var E=[],_=0;_<p;_+=4)E.push(a());return new g.init(E,p)}}),u=d.enc={},y=u.Hex={stringify:function(p){for(var E=p.words,_=p.sigBytes,R=[],T=0;T<_;T++){var F=E[T>>>2]>>>24-T%4*8&255;R.push((F>>>4).toString(16)),R.push((F&15).toString(16))}return R.join("")},parse:function(p){for(var E=p.length,_=[],R=0;R<E;R+=2)_[R>>>3]|=parseInt(p.substr(R,2),16)<<24-R%8*4;return new g.init(_,E/2)}},w=u.Latin1={stringify:function(p){for(var E=p.words,_=p.sigBytes,R=[],T=0;T<_;T++){var F=E[T>>>2]>>>24-T%4*8&255;R.push(String.fromCharCode(F))}return R.join("")},parse:function(p){for(var E=p.length,_=[],R=0;R<E;R++)_[R>>>2]|=(p.charCodeAt(R)&255)<<24-R%4*8;return new g.init(_,E)}},b=u.Utf8={stringify:function(p){try{return decodeURIComponent(escape(w.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return w.parse(unescape(encodeURIComponent(p)))}},C=c.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(p){typeof p=="string"&&(p=b.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes},_process:function(p){var E,_=this._data,R=_.words,T=_.sigBytes,F=this.blockSize,h=F*4,O=T/h;p?O=s.ceil(O):O=s.max((O|0)-this._minBufferSize,0);var A=O*F,f=s.min(A*4,T);if(A){for(var v=0;v<A;v+=F)this._doProcessBlock(R,v);E=R.splice(0,A),_.sigBytes-=f}return new g.init(E,f)},clone:function(){var p=l.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});c.Hasher=C.extend({cfg:l.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset()},reset:function(){C.reset.call(this),this._doReset()},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var E=this._doFinalize();return E},blockSize:16,_createHelper:function(p){return function(E,_){return new p.init(_).finalize(E)}},_createHmacHelper:function(p){return function(E,_){return new x.HMAC.init(p,_).finalize(E)}}});var x=d.algo={};return d}(Math);return t})}(Ks)),Ks.exports}var Zs={exports:{}},Mn;function os(){return Mn||(Mn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.Base,o=n.WordArray,d=i.x64={};d.Word=a.extend({init:function(c,l){this.high=c,this.low=l}}),d.WordArray=a.extend({init:function(c,l){c=this.words=c||[],l!=s?this.sigBytes=l:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,l=c.length,g=[],u=0;u<l;u++){var y=c[u];g.push(y.high),g.push(y.low)}return o.create(g,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),l=c.words=this.words.slice(0),g=l.length,u=0;u<g;u++)l[u]=l[u].clone();return c}})}(),t})}(Zs)),Zs.exports}var Xs={exports:{}},jn;function d0(){return jn||(jn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){if(typeof ArrayBuffer=="function"){var s=t,i=s.lib,n=i.WordArray,a=n.init,o=n.init=function(d){if(d instanceof ArrayBuffer&&(d=new Uint8Array(d)),(d instanceof Int8Array||typeof Uint8ClampedArray<"u"&&d instanceof Uint8ClampedArray||d instanceof Int16Array||d instanceof Uint16Array||d instanceof Int32Array||d instanceof Uint32Array||d instanceof Float32Array||d instanceof Float64Array)&&(d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength)),d instanceof Uint8Array){for(var c=d.byteLength,l=[],g=0;g<c;g++)l[g>>>2]|=d[g]<<24-g%4*8;a.call(this,l,c)}else a.apply(this,arguments)};o.prototype=n}}(),t.lib.WordArray})}(Xs)),Xs.exports}var Js={exports:{}},qn;function h0(){return qn||(qn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=s.enc;a.Utf16=a.Utf16BE={stringify:function(d){for(var c=d.words,l=d.sigBytes,g=[],u=0;u<l;u+=2){var y=c[u>>>2]>>>16-u%4*8&65535;g.push(String.fromCharCode(y))}return g.join("")},parse:function(d){for(var c=d.length,l=[],g=0;g<c;g++)l[g>>>1]|=d.charCodeAt(g)<<16-g%2*16;return n.create(l,c*2)}},a.Utf16LE={stringify:function(d){for(var c=d.words,l=d.sigBytes,g=[],u=0;u<l;u+=2){var y=o(c[u>>>2]>>>16-u%4*8&65535);g.push(String.fromCharCode(y))}return g.join("")},parse:function(d){for(var c=d.length,l=[],g=0;g<c;g++)l[g>>>1]|=o(d.charCodeAt(g)<<16-g%2*16);return n.create(l,c*2)}};function o(d){return d<<8&4278255360|d>>>8&16711935}}(),t.enc.Utf16})}(Js)),Js.exports}var Qs={exports:{}},Un;function sr(){return Un||(Un=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=s.enc;a.Base64={stringify:function(d){var c=d.words,l=d.sigBytes,g=this._map;d.clamp();for(var u=[],y=0;y<l;y+=3)for(var w=c[y>>>2]>>>24-y%4*8&255,b=c[y+1>>>2]>>>24-(y+1)%4*8&255,C=c[y+2>>>2]>>>24-(y+2)%4*8&255,x=w<<16|b<<8|C,p=0;p<4&&y+p*.75<l;p++)u.push(g.charAt(x>>>6*(3-p)&63));var E=g.charAt(64);if(E)for(;u.length%4;)u.push(E);return u.join("")},parse:function(d){var c=d.length,l=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var u=0;u<l.length;u++)g[l.charCodeAt(u)]=u}var y=l.charAt(64);if(y){var w=d.indexOf(y);w!==-1&&(c=w)}return o(d,c,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(d,c,l){for(var g=[],u=0,y=0;y<c;y++)if(y%4){var w=l[d.charCodeAt(y-1)]<<y%4*2,b=l[d.charCodeAt(y)]>>>6-y%4*2,C=w|b;g[u>>>2]|=C<<24-u%4*8,u++}return n.create(g,u)}}(),t.enc.Base64})}(Qs)),Qs.exports}var ei={exports:{}},Ln;function u0(){return Ln||(Ln=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=s.enc;a.Base64url={stringify:function(d,c){c===void 0&&(c=!0);var l=d.words,g=d.sigBytes,u=c?this._safe_map:this._map;d.clamp();for(var y=[],w=0;w<g;w+=3)for(var b=l[w>>>2]>>>24-w%4*8&255,C=l[w+1>>>2]>>>24-(w+1)%4*8&255,x=l[w+2>>>2]>>>24-(w+2)%4*8&255,p=b<<16|C<<8|x,E=0;E<4&&w+E*.75<g;E++)y.push(u.charAt(p>>>6*(3-E)&63));var _=u.charAt(64);if(_)for(;y.length%4;)y.push(_);return y.join("")},parse:function(d,c){c===void 0&&(c=!0);var l=d.length,g=c?this._safe_map:this._map,u=this._reverseMap;if(!u){u=this._reverseMap=[];for(var y=0;y<g.length;y++)u[g.charCodeAt(y)]=y}var w=g.charAt(64);if(w){var b=d.indexOf(w);b!==-1&&(l=b)}return o(d,l,u)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(d,c,l){for(var g=[],u=0,y=0;y<c;y++)if(y%4){var w=l[d.charCodeAt(y-1)]<<y%4*2,b=l[d.charCodeAt(y)]>>>6-y%4*2,C=w|b;g[u>>>2]|=C<<24-u%4*8,u++}return n.create(g,u)}}(),t.enc.Base64url})}(ei)),ei.exports}var ti={exports:{}},Yn;function ir(){return Yn||(Yn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=[];(function(){for(var b=0;b<64;b++)c[b]=s.abs(s.sin(b+1))*4294967296|0})();var l=d.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(b,C){for(var x=0;x<16;x++){var p=C+x,E=b[p];b[p]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}var _=this._hash.words,R=b[C+0],T=b[C+1],F=b[C+2],h=b[C+3],O=b[C+4],A=b[C+5],f=b[C+6],v=b[C+7],m=b[C+8],U=b[C+9],j=b[C+10],X=b[C+11],G=b[C+12],ne=b[C+13],he=b[C+14],ue=b[C+15],I=_[0],H=_[1],$=_[2],P=_[3];I=g(I,H,$,P,R,7,c[0]),P=g(P,I,H,$,T,12,c[1]),$=g($,P,I,H,F,17,c[2]),H=g(H,$,P,I,h,22,c[3]),I=g(I,H,$,P,O,7,c[4]),P=g(P,I,H,$,A,12,c[5]),$=g($,P,I,H,f,17,c[6]),H=g(H,$,P,I,v,22,c[7]),I=g(I,H,$,P,m,7,c[8]),P=g(P,I,H,$,U,12,c[9]),$=g($,P,I,H,j,17,c[10]),H=g(H,$,P,I,X,22,c[11]),I=g(I,H,$,P,G,7,c[12]),P=g(P,I,H,$,ne,12,c[13]),$=g($,P,I,H,he,17,c[14]),H=g(H,$,P,I,ue,22,c[15]),I=u(I,H,$,P,T,5,c[16]),P=u(P,I,H,$,f,9,c[17]),$=u($,P,I,H,X,14,c[18]),H=u(H,$,P,I,R,20,c[19]),I=u(I,H,$,P,A,5,c[20]),P=u(P,I,H,$,j,9,c[21]),$=u($,P,I,H,ue,14,c[22]),H=u(H,$,P,I,O,20,c[23]),I=u(I,H,$,P,U,5,c[24]),P=u(P,I,H,$,he,9,c[25]),$=u($,P,I,H,h,14,c[26]),H=u(H,$,P,I,m,20,c[27]),I=u(I,H,$,P,ne,5,c[28]),P=u(P,I,H,$,F,9,c[29]),$=u($,P,I,H,v,14,c[30]),H=u(H,$,P,I,G,20,c[31]),I=y(I,H,$,P,A,4,c[32]),P=y(P,I,H,$,m,11,c[33]),$=y($,P,I,H,X,16,c[34]),H=y(H,$,P,I,he,23,c[35]),I=y(I,H,$,P,T,4,c[36]),P=y(P,I,H,$,O,11,c[37]),$=y($,P,I,H,v,16,c[38]),H=y(H,$,P,I,j,23,c[39]),I=y(I,H,$,P,ne,4,c[40]),P=y(P,I,H,$,R,11,c[41]),$=y($,P,I,H,h,16,c[42]),H=y(H,$,P,I,f,23,c[43]),I=y(I,H,$,P,U,4,c[44]),P=y(P,I,H,$,G,11,c[45]),$=y($,P,I,H,ue,16,c[46]),H=y(H,$,P,I,F,23,c[47]),I=w(I,H,$,P,R,6,c[48]),P=w(P,I,H,$,v,10,c[49]),$=w($,P,I,H,he,15,c[50]),H=w(H,$,P,I,A,21,c[51]),I=w(I,H,$,P,G,6,c[52]),P=w(P,I,H,$,h,10,c[53]),$=w($,P,I,H,j,15,c[54]),H=w(H,$,P,I,T,21,c[55]),I=w(I,H,$,P,m,6,c[56]),P=w(P,I,H,$,ue,10,c[57]),$=w($,P,I,H,f,15,c[58]),H=w(H,$,P,I,ne,21,c[59]),I=w(I,H,$,P,O,6,c[60]),P=w(P,I,H,$,X,10,c[61]),$=w($,P,I,H,F,15,c[62]),H=w(H,$,P,I,U,21,c[63]),_[0]=_[0]+I|0,_[1]=_[1]+H|0,_[2]=_[2]+$|0,_[3]=_[3]+P|0},_doFinalize:function(){var b=this._data,C=b.words,x=this._nDataBytes*8,p=b.sigBytes*8;C[p>>>5]|=128<<24-p%32;var E=s.floor(x/4294967296),_=x;C[(p+64>>>9<<4)+15]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,C[(p+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,b.sigBytes=(C.length+1)*4,this._process();for(var R=this._hash,T=R.words,F=0;F<4;F++){var h=T[F];T[F]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}return R},clone:function(){var b=o.clone.call(this);return b._hash=this._hash.clone(),b}});function g(b,C,x,p,E,_,R){var T=b+(C&x|~C&p)+E+R;return(T<<_|T>>>32-_)+C}function u(b,C,x,p,E,_,R){var T=b+(C&p|x&~p)+E+R;return(T<<_|T>>>32-_)+C}function y(b,C,x,p,E,_,R){var T=b+(C^x^p)+E+R;return(T<<_|T>>>32-_)+C}function w(b,C,x,p,E,_,R){var T=b+(x^(C|~p))+E+R;return(T<<_|T>>>32-_)+C}i.MD5=o._createHelper(l),i.HmacMD5=o._createHmacHelper(l)}(Math),t.MD5})}(ti)),ti.exports}var ri={exports:{}},Wn;function Gn(){return Wn||(Wn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=i.Hasher,o=s.algo,d=[],c=o.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,g){for(var u=this._hash.words,y=u[0],w=u[1],b=u[2],C=u[3],x=u[4],p=0;p<80;p++){if(p<16)d[p]=l[g+p]|0;else{var E=d[p-3]^d[p-8]^d[p-14]^d[p-16];d[p]=E<<1|E>>>31}var _=(y<<5|y>>>27)+x+d[p];p<20?_+=(w&b|~w&C)+1518500249:p<40?_+=(w^b^C)+1859775393:p<60?_+=(w&b|w&C|b&C)-1894007588:_+=(w^b^C)-899497514,x=C,C=b,b=w<<30|w>>>2,w=y,y=_}u[0]=u[0]+y|0,u[1]=u[1]+w|0,u[2]=u[2]+b|0,u[3]=u[3]+C|0,u[4]=u[4]+x|0},_doFinalize:function(){var l=this._data,g=l.words,u=this._nDataBytes*8,y=l.sigBytes*8;return g[y>>>5]|=128<<24-y%32,g[(y+64>>>9<<4)+14]=Math.floor(u/4294967296),g[(y+64>>>9<<4)+15]=u,l.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});s.SHA1=a._createHelper(c),s.HmacSHA1=a._createHmacHelper(c)}(),t.SHA1})}(ri)),ri.exports}var si={exports:{}},Vn;function ii(){return Vn||(Vn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=[],l=[];(function(){function y(x){for(var p=s.sqrt(x),E=2;E<=p;E++)if(!(x%E))return!1;return!0}function w(x){return(x-(x|0))*4294967296|0}for(var b=2,C=0;C<64;)y(b)&&(C<8&&(c[C]=w(s.pow(b,1/2))),l[C]=w(s.pow(b,1/3)),C++),b++})();var g=[],u=d.SHA256=o.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(y,w){for(var b=this._hash.words,C=b[0],x=b[1],p=b[2],E=b[3],_=b[4],R=b[5],T=b[6],F=b[7],h=0;h<64;h++){if(h<16)g[h]=y[w+h]|0;else{var O=g[h-15],A=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,f=g[h-2],v=(f<<15|f>>>17)^(f<<13|f>>>19)^f>>>10;g[h]=A+g[h-7]+v+g[h-16]}var m=_&R^~_&T,U=C&x^C&p^x&p,j=(C<<30|C>>>2)^(C<<19|C>>>13)^(C<<10|C>>>22),X=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),G=F+X+m+l[h]+g[h],ne=j+U;F=T,T=R,R=_,_=E+G|0,E=p,p=x,x=C,C=G+ne|0}b[0]=b[0]+C|0,b[1]=b[1]+x|0,b[2]=b[2]+p|0,b[3]=b[3]+E|0,b[4]=b[4]+_|0,b[5]=b[5]+R|0,b[6]=b[6]+T|0,b[7]=b[7]+F|0},_doFinalize:function(){var y=this._data,w=y.words,b=this._nDataBytes*8,C=y.sigBytes*8;return w[C>>>5]|=128<<24-C%32,w[(C+64>>>9<<4)+14]=s.floor(b/4294967296),w[(C+64>>>9<<4)+15]=b,y.sigBytes=w.length*4,this._process(),this._hash},clone:function(){var y=o.clone.call(this);return y._hash=this._hash.clone(),y}});i.SHA256=o._createHelper(u),i.HmacSHA256=o._createHmacHelper(u)}(Math),t.SHA256})}(si)),si.exports}var ni={exports:{}},zn;function f0(){return zn||(zn=1,function(r,e){(function(t,s,i){r.exports=s(ce(),ii())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=s.algo,o=a.SHA256,d=a.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=o._doFinalize.call(this);return c.sigBytes-=4,c}});s.SHA224=o._createHelper(d),s.HmacSHA224=o._createHmacHelper(d)}(),t.SHA224})}(ni)),ni.exports}var ai={exports:{}},Kn;function Zn(){return Kn||(Kn=1,function(r,e){(function(t,s,i){r.exports=s(ce(),os())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.Hasher,a=s.x64,o=a.Word,d=a.WordArray,c=s.algo;function l(){return o.create.apply(o,arguments)}var g=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],u=[];(function(){for(var w=0;w<80;w++)u[w]=l()})();var y=c.SHA512=n.extend({_doReset:function(){this._hash=new d.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(w,b){for(var C=this._hash.words,x=C[0],p=C[1],E=C[2],_=C[3],R=C[4],T=C[5],F=C[6],h=C[7],O=x.high,A=x.low,f=p.high,v=p.low,m=E.high,U=E.low,j=_.high,X=_.low,G=R.high,ne=R.low,he=T.high,ue=T.low,I=F.high,H=F.low,$=h.high,P=h.low,we=O,pe=A,ke=f,q=v,W=m,Ee=U,ct=j,pt=X,Ye=G,Oe=ne,lt=he,Xe=ue,Tt=I,mt=H,vt=$,gr=P,rt=0;rt<80;rt++){var We,Rt,kr=u[rt];if(rt<16)Rt=kr.high=w[b+rt*2]|0,We=kr.low=w[b+rt*2+1]|0;else{var ts=u[rt-15],Ut=ts.high,tr=ts.low,bn=(Ut>>>1|tr<<31)^(Ut>>>8|tr<<24)^Ut>>>7,rs=(tr>>>1|Ut<<31)^(tr>>>8|Ut<<24)^(tr>>>7|Ut<<25),ss=u[rt-2],rr=ss.high,xr=ss.low,Cn=(rr>>>19|xr<<13)^(rr<<3|xr>>>29)^rr>>>6,Os=(xr>>>19|rr<<13)^(xr<<3|rr>>>29)^(xr>>>6|rr<<26),Ms=u[rt-7],_n=Ms.high,Dn=Ms.low,Br=u[rt-16],js=Br.high,Lt=Br.low;We=rs+Dn,Rt=bn+_n+(We>>>0<rs>>>0?1:0),We=We+Os,Rt=Rt+Cn+(We>>>0<Os>>>0?1:0),We=We+Lt,Rt=Rt+js+(We>>>0<Lt>>>0?1:0),kr.high=Rt,kr.low=We}var is=Ye<^~Ye&Tt,Ir=Oe&Xe^~Oe&mt,qs=we&ke^we&W^ke&W,An=pe&q^pe&Ee^q&Ee,Us=(we>>>28|pe<<4)^(we<<30|pe>>>2)^(we<<25|pe>>>7),Ls=(pe>>>28|we<<4)^(pe<<30|we>>>2)^(pe<<25|we>>>7),Ys=(Ye>>>14|Oe<<18)^(Ye>>>18|Oe<<14)^(Ye<<23|Oe>>>9),Ws=(Oe>>>14|Ye<<18)^(Oe>>>18|Ye<<14)^(Oe<<23|Ye>>>9),Gs=g[rt],Sn=Gs.high,ns=Gs.low,Ge=gr+Ws,Ft=vt+Ys+(Ge>>>0<gr>>>0?1:0),Ge=Ge+Ir,Ft=Ft+is+(Ge>>>0<Ir>>>0?1:0),Ge=Ge+ns,Ft=Ft+Sn+(Ge>>>0<ns>>>0?1:0),Ge=Ge+We,Ft=Ft+Rt+(Ge>>>0<We>>>0?1:0),Vs=Ls+An,Tn=Us+qs+(Vs>>>0<Ls>>>0?1:0);vt=Tt,gr=mt,Tt=lt,mt=Xe,lt=Ye,Xe=Oe,Oe=pt+Ge|0,Ye=ct+Ft+(Oe>>>0<pt>>>0?1:0)|0,ct=W,pt=Ee,W=ke,Ee=q,ke=we,q=pe,pe=Ge+Vs|0,we=Ft+Tn+(pe>>>0<Ge>>>0?1:0)|0}A=x.low=A+pe,x.high=O+we+(A>>>0<pe>>>0?1:0),v=p.low=v+q,p.high=f+ke+(v>>>0<q>>>0?1:0),U=E.low=U+Ee,E.high=m+W+(U>>>0<Ee>>>0?1:0),X=_.low=X+pt,_.high=j+ct+(X>>>0<pt>>>0?1:0),ne=R.low=ne+Oe,R.high=G+Ye+(ne>>>0<Oe>>>0?1:0),ue=T.low=ue+Xe,T.high=he+lt+(ue>>>0<Xe>>>0?1:0),H=F.low=H+mt,F.high=I+Tt+(H>>>0<mt>>>0?1:0),P=h.low=P+gr,h.high=$+vt+(P>>>0<gr>>>0?1:0)},_doFinalize:function(){var w=this._data,b=w.words,C=this._nDataBytes*8,x=w.sigBytes*8;b[x>>>5]|=128<<24-x%32,b[(x+128>>>10<<5)+30]=Math.floor(C/4294967296),b[(x+128>>>10<<5)+31]=C,w.sigBytes=b.length*4,this._process();var p=this._hash.toX32();return p},clone:function(){var w=n.clone.call(this);return w._hash=this._hash.clone(),w},blockSize:1024/32});s.SHA512=n._createHelper(y),s.HmacSHA512=n._createHmacHelper(y)}(),t.SHA512})}(ai)),ai.exports}var oi={exports:{}},Xn;function g0(){return Xn||(Xn=1,function(r,e){(function(t,s,i){r.exports=s(ce(),os(),Zn())})(ie,function(t){return function(){var s=t,i=s.x64,n=i.Word,a=i.WordArray,o=s.algo,d=o.SHA512,c=o.SHA384=d.extend({_doReset:function(){this._hash=new a.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var l=d._doFinalize.call(this);return l.sigBytes-=16,l}});s.SHA384=d._createHelper(c),s.HmacSHA384=d._createHmacHelper(c)}(),t.SHA384})}(oi)),oi.exports}var ci={exports:{}},Jn;function x0(){return Jn||(Jn=1,function(r,e){(function(t,s,i){r.exports=s(ce(),os())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.x64,c=d.Word,l=i.algo,g=[],u=[],y=[];(function(){for(var C=1,x=0,p=0;p<24;p++){g[C+5*x]=(p+1)*(p+2)/2%64;var E=x%5,_=(2*C+3*x)%5;C=E,x=_}for(var C=0;C<5;C++)for(var x=0;x<5;x++)u[C+5*x]=x+(2*C+3*x)%5*5;for(var R=1,T=0;T<24;T++){for(var F=0,h=0,O=0;O<7;O++){if(R&1){var A=(1<<O)-1;A<32?h^=1<<A:F^=1<<A-32}R&128?R=R<<1^113:R<<=1}y[T]=c.create(F,h)}})();var w=[];(function(){for(var C=0;C<25;C++)w[C]=c.create()})();var b=l.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var C=this._state=[],x=0;x<25;x++)C[x]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(C,x){for(var p=this._state,E=this.blockSize/2,_=0;_<E;_++){var R=C[x+2*_],T=C[x+2*_+1];R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360;var F=p[_];F.high^=T,F.low^=R}for(var h=0;h<24;h++){for(var O=0;O<5;O++){for(var A=0,f=0,v=0;v<5;v++){var F=p[O+5*v];A^=F.high,f^=F.low}var m=w[O];m.high=A,m.low=f}for(var O=0;O<5;O++)for(var U=w[(O+4)%5],j=w[(O+1)%5],X=j.high,G=j.low,A=U.high^(X<<1|G>>>31),f=U.low^(G<<1|X>>>31),v=0;v<5;v++){var F=p[O+5*v];F.high^=A,F.low^=f}for(var ne=1;ne<25;ne++){var A,f,F=p[ne],he=F.high,ue=F.low,I=g[ne];I<32?(A=he<<I|ue>>>32-I,f=ue<<I|he>>>32-I):(A=ue<<I-32|he>>>64-I,f=he<<I-32|ue>>>64-I);var H=w[u[ne]];H.high=A,H.low=f}var $=w[0],P=p[0];$.high=P.high,$.low=P.low;for(var O=0;O<5;O++)for(var v=0;v<5;v++){var ne=O+5*v,F=p[ne],we=w[ne],pe=w[(O+1)%5+5*v],ke=w[(O+2)%5+5*v];F.high=we.high^~pe.high&ke.high,F.low=we.low^~pe.low&ke.low}var F=p[0],q=y[h];F.high^=q.high,F.low^=q.low}},_doFinalize:function(){var C=this._data,x=C.words;this._nDataBytes*8;var p=C.sigBytes*8,E=this.blockSize*32;x[p>>>5]|=1<<24-p%32,x[(s.ceil((p+1)/E)*E>>>5)-1]|=128,C.sigBytes=x.length*4,this._process();for(var _=this._state,R=this.cfg.outputLength/8,T=R/8,F=[],h=0;h<T;h++){var O=_[h],A=O.high,f=O.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,f=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360,F.push(f),F.push(A)}return new a.init(F,R)},clone:function(){for(var C=o.clone.call(this),x=C._state=this._state.slice(0),p=0;p<25;p++)x[p]=x[p].clone();return C}});i.SHA3=o._createHelper(b),i.HmacSHA3=o._createHmacHelper(b)}(Math),t.SHA3})}(ci)),ci.exports}var li={exports:{}},Qn;function p0(){return Qn||(Qn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){/** @preserve
|
|
130
|
+
`,children:[S.jsx("span",{className:"text-[22px] font-medium text-gray-800 leading-none",children:e}),t?S.jsx("span",{className:"text-[9px] text-gray-400 font-semibold tracking-[0.18em] mt-1.5",children:t}):S.jsx("span",{className:"h-3.5"})]},e))});class o0{constructor(){this.listeners={}}on(e,t){return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t),()=>this.off(e,t)}off(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(s=>s!==t))}emitLocal(e,t){this.listeners[e]&&this.listeners[e].forEach(s=>{try{s(t)}catch(i){console.error(`Error in event listener for ${e}:`,i)}})}emitToParent(e,t){this.emitLocal(e,t)}}const z=new o0;var Nn={exports:{}};function c0(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ks={exports:{}};const l0=Wo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var On;function ce(){return On||(On=1,function(r,e){(function(t,s){r.exports=s()})(ie,function(){var t=t||function(s,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof ie<"u"&&ie.crypto&&(n=ie.crypto),!n&&typeof c0=="function")try{n=l0}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(E){var _;return p.prototype=E,_=new p,p.prototype=null,_}}(),d={},c=d.lib={},l=c.Base=function(){return{extend:function(p){var E=o(this);return p&&E.mixIn(p),(!E.hasOwnProperty("init")||this.init===E.init)&&(E.init=function(){E.$super.init.apply(this,arguments)}),E.init.prototype=E,E.$super=this,E},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var E in p)p.hasOwnProperty(E)&&(this[E]=p[E]);p.hasOwnProperty("toString")&&(this.toString=p.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=c.WordArray=l.extend({init:function(p,E){p=this.words=p||[],E!=i?this.sigBytes=E:this.sigBytes=p.length*4},toString:function(p){return(p||w).stringify(this)},concat:function(p){var E=this.words,_=p.words,R=this.sigBytes,T=p.sigBytes;if(this.clamp(),R%4)for(var F=0;F<T;F++){var h=_[F>>>2]>>>24-F%4*8&255;E[R+F>>>2]|=h<<24-(R+F)%4*8}else for(var O=0;O<T;O+=4)E[R+O>>>2]=_[O>>>2];return this.sigBytes+=T,this},clamp:function(){var p=this.words,E=this.sigBytes;p[E>>>2]&=4294967295<<32-E%4*8,p.length=s.ceil(E/4)},clone:function(){var p=l.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var E=[],_=0;_<p;_+=4)E.push(a());return new g.init(E,p)}}),f=d.enc={},w=f.Hex={stringify:function(p){for(var E=p.words,_=p.sigBytes,R=[],T=0;T<_;T++){var F=E[T>>>2]>>>24-T%4*8&255;R.push((F>>>4).toString(16)),R.push((F&15).toString(16))}return R.join("")},parse:function(p){for(var E=p.length,_=[],R=0;R<E;R+=2)_[R>>>3]|=parseInt(p.substr(R,2),16)<<24-R%8*4;return new g.init(_,E/2)}},y=f.Latin1={stringify:function(p){for(var E=p.words,_=p.sigBytes,R=[],T=0;T<_;T++){var F=E[T>>>2]>>>24-T%4*8&255;R.push(String.fromCharCode(F))}return R.join("")},parse:function(p){for(var E=p.length,_=[],R=0;R<E;R++)_[R>>>2]|=(p.charCodeAt(R)&255)<<24-R%4*8;return new g.init(_,E)}},b=f.Utf8={stringify:function(p){try{return decodeURIComponent(escape(y.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return y.parse(unescape(encodeURIComponent(p)))}},C=c.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(p){typeof p=="string"&&(p=b.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes},_process:function(p){var E,_=this._data,R=_.words,T=_.sigBytes,F=this.blockSize,h=F*4,O=T/h;p?O=s.ceil(O):O=s.max((O|0)-this._minBufferSize,0);var A=O*F,u=s.min(A*4,T);if(A){for(var v=0;v<A;v+=F)this._doProcessBlock(R,v);E=R.splice(0,A),_.sigBytes-=u}return new g.init(E,u)},clone:function(){var p=l.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});c.Hasher=C.extend({cfg:l.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset()},reset:function(){C.reset.call(this),this._doReset()},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var E=this._doFinalize();return E},blockSize:16,_createHelper:function(p){return function(E,_){return new p.init(_).finalize(E)}},_createHmacHelper:function(p){return function(E,_){return new x.HMAC.init(p,_).finalize(E)}}});var x=d.algo={};return d}(Math);return t})}(Ks)),Ks.exports}var Zs={exports:{}},Mn;function os(){return Mn||(Mn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.Base,o=n.WordArray,d=i.x64={};d.Word=a.extend({init:function(c,l){this.high=c,this.low=l}}),d.WordArray=a.extend({init:function(c,l){c=this.words=c||[],l!=s?this.sigBytes=l:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,l=c.length,g=[],f=0;f<l;f++){var w=c[f];g.push(w.high),g.push(w.low)}return o.create(g,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),l=c.words=this.words.slice(0),g=l.length,f=0;f<g;f++)l[f]=l[f].clone();return c}})}(),t})}(Zs)),Zs.exports}var Xs={exports:{}},jn;function d0(){return jn||(jn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){if(typeof ArrayBuffer=="function"){var s=t,i=s.lib,n=i.WordArray,a=n.init,o=n.init=function(d){if(d instanceof ArrayBuffer&&(d=new Uint8Array(d)),(d instanceof Int8Array||typeof Uint8ClampedArray<"u"&&d instanceof Uint8ClampedArray||d instanceof Int16Array||d instanceof Uint16Array||d instanceof Int32Array||d instanceof Uint32Array||d instanceof Float32Array||d instanceof Float64Array)&&(d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength)),d instanceof Uint8Array){for(var c=d.byteLength,l=[],g=0;g<c;g++)l[g>>>2]|=d[g]<<24-g%4*8;a.call(this,l,c)}else a.apply(this,arguments)};o.prototype=n}}(),t.lib.WordArray})}(Xs)),Xs.exports}var Js={exports:{}},qn;function h0(){return qn||(qn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=s.enc;a.Utf16=a.Utf16BE={stringify:function(d){for(var c=d.words,l=d.sigBytes,g=[],f=0;f<l;f+=2){var w=c[f>>>2]>>>16-f%4*8&65535;g.push(String.fromCharCode(w))}return g.join("")},parse:function(d){for(var c=d.length,l=[],g=0;g<c;g++)l[g>>>1]|=d.charCodeAt(g)<<16-g%2*16;return n.create(l,c*2)}},a.Utf16LE={stringify:function(d){for(var c=d.words,l=d.sigBytes,g=[],f=0;f<l;f+=2){var w=o(c[f>>>2]>>>16-f%4*8&65535);g.push(String.fromCharCode(w))}return g.join("")},parse:function(d){for(var c=d.length,l=[],g=0;g<c;g++)l[g>>>1]|=o(d.charCodeAt(g)<<16-g%2*16);return n.create(l,c*2)}};function o(d){return d<<8&4278255360|d>>>8&16711935}}(),t.enc.Utf16})}(Js)),Js.exports}var Qs={exports:{}},Un;function sr(){return Un||(Un=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=s.enc;a.Base64={stringify:function(d){var c=d.words,l=d.sigBytes,g=this._map;d.clamp();for(var f=[],w=0;w<l;w+=3)for(var y=c[w>>>2]>>>24-w%4*8&255,b=c[w+1>>>2]>>>24-(w+1)%4*8&255,C=c[w+2>>>2]>>>24-(w+2)%4*8&255,x=y<<16|b<<8|C,p=0;p<4&&w+p*.75<l;p++)f.push(g.charAt(x>>>6*(3-p)&63));var E=g.charAt(64);if(E)for(;f.length%4;)f.push(E);return f.join("")},parse:function(d){var c=d.length,l=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var f=0;f<l.length;f++)g[l.charCodeAt(f)]=f}var w=l.charAt(64);if(w){var y=d.indexOf(w);y!==-1&&(c=y)}return o(d,c,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(d,c,l){for(var g=[],f=0,w=0;w<c;w++)if(w%4){var y=l[d.charCodeAt(w-1)]<<w%4*2,b=l[d.charCodeAt(w)]>>>6-w%4*2,C=y|b;g[f>>>2]|=C<<24-f%4*8,f++}return n.create(g,f)}}(),t.enc.Base64})}(Qs)),Qs.exports}var ei={exports:{}},Ln;function u0(){return Ln||(Ln=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=s.enc;a.Base64url={stringify:function(d,c){c===void 0&&(c=!0);var l=d.words,g=d.sigBytes,f=c?this._safe_map:this._map;d.clamp();for(var w=[],y=0;y<g;y+=3)for(var b=l[y>>>2]>>>24-y%4*8&255,C=l[y+1>>>2]>>>24-(y+1)%4*8&255,x=l[y+2>>>2]>>>24-(y+2)%4*8&255,p=b<<16|C<<8|x,E=0;E<4&&y+E*.75<g;E++)w.push(f.charAt(p>>>6*(3-E)&63));var _=f.charAt(64);if(_)for(;w.length%4;)w.push(_);return w.join("")},parse:function(d,c){c===void 0&&(c=!0);var l=d.length,g=c?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var w=0;w<g.length;w++)f[g.charCodeAt(w)]=w}var y=g.charAt(64);if(y){var b=d.indexOf(y);b!==-1&&(l=b)}return o(d,l,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(d,c,l){for(var g=[],f=0,w=0;w<c;w++)if(w%4){var y=l[d.charCodeAt(w-1)]<<w%4*2,b=l[d.charCodeAt(w)]>>>6-w%4*2,C=y|b;g[f>>>2]|=C<<24-f%4*8,f++}return n.create(g,f)}}(),t.enc.Base64url})}(ei)),ei.exports}var ti={exports:{}},Yn;function ir(){return Yn||(Yn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=[];(function(){for(var b=0;b<64;b++)c[b]=s.abs(s.sin(b+1))*4294967296|0})();var l=d.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(b,C){for(var x=0;x<16;x++){var p=C+x,E=b[p];b[p]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}var _=this._hash.words,R=b[C+0],T=b[C+1],F=b[C+2],h=b[C+3],O=b[C+4],A=b[C+5],u=b[C+6],v=b[C+7],m=b[C+8],U=b[C+9],j=b[C+10],J=b[C+11],V=b[C+12],ne=b[C+13],he=b[C+14],ue=b[C+15],I=_[0],P=_[1],$=_[2],H=_[3];I=g(I,P,$,H,R,7,c[0]),H=g(H,I,P,$,T,12,c[1]),$=g($,H,I,P,F,17,c[2]),P=g(P,$,H,I,h,22,c[3]),I=g(I,P,$,H,O,7,c[4]),H=g(H,I,P,$,A,12,c[5]),$=g($,H,I,P,u,17,c[6]),P=g(P,$,H,I,v,22,c[7]),I=g(I,P,$,H,m,7,c[8]),H=g(H,I,P,$,U,12,c[9]),$=g($,H,I,P,j,17,c[10]),P=g(P,$,H,I,J,22,c[11]),I=g(I,P,$,H,V,7,c[12]),H=g(H,I,P,$,ne,12,c[13]),$=g($,H,I,P,he,17,c[14]),P=g(P,$,H,I,ue,22,c[15]),I=f(I,P,$,H,T,5,c[16]),H=f(H,I,P,$,u,9,c[17]),$=f($,H,I,P,J,14,c[18]),P=f(P,$,H,I,R,20,c[19]),I=f(I,P,$,H,A,5,c[20]),H=f(H,I,P,$,j,9,c[21]),$=f($,H,I,P,ue,14,c[22]),P=f(P,$,H,I,O,20,c[23]),I=f(I,P,$,H,U,5,c[24]),H=f(H,I,P,$,he,9,c[25]),$=f($,H,I,P,h,14,c[26]),P=f(P,$,H,I,m,20,c[27]),I=f(I,P,$,H,ne,5,c[28]),H=f(H,I,P,$,F,9,c[29]),$=f($,H,I,P,v,14,c[30]),P=f(P,$,H,I,V,20,c[31]),I=w(I,P,$,H,A,4,c[32]),H=w(H,I,P,$,m,11,c[33]),$=w($,H,I,P,J,16,c[34]),P=w(P,$,H,I,he,23,c[35]),I=w(I,P,$,H,T,4,c[36]),H=w(H,I,P,$,O,11,c[37]),$=w($,H,I,P,v,16,c[38]),P=w(P,$,H,I,j,23,c[39]),I=w(I,P,$,H,ne,4,c[40]),H=w(H,I,P,$,R,11,c[41]),$=w($,H,I,P,h,16,c[42]),P=w(P,$,H,I,u,23,c[43]),I=w(I,P,$,H,U,4,c[44]),H=w(H,I,P,$,V,11,c[45]),$=w($,H,I,P,ue,16,c[46]),P=w(P,$,H,I,F,23,c[47]),I=y(I,P,$,H,R,6,c[48]),H=y(H,I,P,$,v,10,c[49]),$=y($,H,I,P,he,15,c[50]),P=y(P,$,H,I,A,21,c[51]),I=y(I,P,$,H,V,6,c[52]),H=y(H,I,P,$,h,10,c[53]),$=y($,H,I,P,j,15,c[54]),P=y(P,$,H,I,T,21,c[55]),I=y(I,P,$,H,m,6,c[56]),H=y(H,I,P,$,ue,10,c[57]),$=y($,H,I,P,u,15,c[58]),P=y(P,$,H,I,ne,21,c[59]),I=y(I,P,$,H,O,6,c[60]),H=y(H,I,P,$,J,10,c[61]),$=y($,H,I,P,F,15,c[62]),P=y(P,$,H,I,U,21,c[63]),_[0]=_[0]+I|0,_[1]=_[1]+P|0,_[2]=_[2]+$|0,_[3]=_[3]+H|0},_doFinalize:function(){var b=this._data,C=b.words,x=this._nDataBytes*8,p=b.sigBytes*8;C[p>>>5]|=128<<24-p%32;var E=s.floor(x/4294967296),_=x;C[(p+64>>>9<<4)+15]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,C[(p+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,b.sigBytes=(C.length+1)*4,this._process();for(var R=this._hash,T=R.words,F=0;F<4;F++){var h=T[F];T[F]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}return R},clone:function(){var b=o.clone.call(this);return b._hash=this._hash.clone(),b}});function g(b,C,x,p,E,_,R){var T=b+(C&x|~C&p)+E+R;return(T<<_|T>>>32-_)+C}function f(b,C,x,p,E,_,R){var T=b+(C&p|x&~p)+E+R;return(T<<_|T>>>32-_)+C}function w(b,C,x,p,E,_,R){var T=b+(C^x^p)+E+R;return(T<<_|T>>>32-_)+C}function y(b,C,x,p,E,_,R){var T=b+(x^(C|~p))+E+R;return(T<<_|T>>>32-_)+C}i.MD5=o._createHelper(l),i.HmacMD5=o._createHmacHelper(l)}(Math),t.MD5})}(ti)),ti.exports}var ri={exports:{}},Wn;function Gn(){return Wn||(Wn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=i.Hasher,o=s.algo,d=[],c=o.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,g){for(var f=this._hash.words,w=f[0],y=f[1],b=f[2],C=f[3],x=f[4],p=0;p<80;p++){if(p<16)d[p]=l[g+p]|0;else{var E=d[p-3]^d[p-8]^d[p-14]^d[p-16];d[p]=E<<1|E>>>31}var _=(w<<5|w>>>27)+x+d[p];p<20?_+=(y&b|~y&C)+1518500249:p<40?_+=(y^b^C)+1859775393:p<60?_+=(y&b|y&C|b&C)-1894007588:_+=(y^b^C)-899497514,x=C,C=b,b=y<<30|y>>>2,y=w,w=_}f[0]=f[0]+w|0,f[1]=f[1]+y|0,f[2]=f[2]+b|0,f[3]=f[3]+C|0,f[4]=f[4]+x|0},_doFinalize:function(){var l=this._data,g=l.words,f=this._nDataBytes*8,w=l.sigBytes*8;return g[w>>>5]|=128<<24-w%32,g[(w+64>>>9<<4)+14]=Math.floor(f/4294967296),g[(w+64>>>9<<4)+15]=f,l.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var l=a.clone.call(this);return l._hash=this._hash.clone(),l}});s.SHA1=a._createHelper(c),s.HmacSHA1=a._createHmacHelper(c)}(),t.SHA1})}(ri)),ri.exports}var si={exports:{}},Vn;function ii(){return Vn||(Vn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=[],l=[];(function(){function w(x){for(var p=s.sqrt(x),E=2;E<=p;E++)if(!(x%E))return!1;return!0}function y(x){return(x-(x|0))*4294967296|0}for(var b=2,C=0;C<64;)w(b)&&(C<8&&(c[C]=y(s.pow(b,1/2))),l[C]=y(s.pow(b,1/3)),C++),b++})();var g=[],f=d.SHA256=o.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(w,y){for(var b=this._hash.words,C=b[0],x=b[1],p=b[2],E=b[3],_=b[4],R=b[5],T=b[6],F=b[7],h=0;h<64;h++){if(h<16)g[h]=w[y+h]|0;else{var O=g[h-15],A=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,u=g[h-2],v=(u<<15|u>>>17)^(u<<13|u>>>19)^u>>>10;g[h]=A+g[h-7]+v+g[h-16]}var m=_&R^~_&T,U=C&x^C&p^x&p,j=(C<<30|C>>>2)^(C<<19|C>>>13)^(C<<10|C>>>22),J=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),V=F+J+m+l[h]+g[h],ne=j+U;F=T,T=R,R=_,_=E+V|0,E=p,p=x,x=C,C=V+ne|0}b[0]=b[0]+C|0,b[1]=b[1]+x|0,b[2]=b[2]+p|0,b[3]=b[3]+E|0,b[4]=b[4]+_|0,b[5]=b[5]+R|0,b[6]=b[6]+T|0,b[7]=b[7]+F|0},_doFinalize:function(){var w=this._data,y=w.words,b=this._nDataBytes*8,C=w.sigBytes*8;return y[C>>>5]|=128<<24-C%32,y[(C+64>>>9<<4)+14]=s.floor(b/4294967296),y[(C+64>>>9<<4)+15]=b,w.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var w=o.clone.call(this);return w._hash=this._hash.clone(),w}});i.SHA256=o._createHelper(f),i.HmacSHA256=o._createHmacHelper(f)}(Math),t.SHA256})}(si)),si.exports}var ni={exports:{}},zn;function f0(){return zn||(zn=1,function(r,e){(function(t,s,i){r.exports=s(ce(),ii())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=s.algo,o=a.SHA256,d=a.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=o._doFinalize.call(this);return c.sigBytes-=4,c}});s.SHA224=o._createHelper(d),s.HmacSHA224=o._createHmacHelper(d)}(),t.SHA224})}(ni)),ni.exports}var ai={exports:{}},Kn;function Zn(){return Kn||(Kn=1,function(r,e){(function(t,s,i){r.exports=s(ce(),os())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.Hasher,a=s.x64,o=a.Word,d=a.WordArray,c=s.algo;function l(){return o.create.apply(o,arguments)}var g=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],f=[];(function(){for(var y=0;y<80;y++)f[y]=l()})();var w=c.SHA512=n.extend({_doReset:function(){this._hash=new d.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(y,b){for(var C=this._hash.words,x=C[0],p=C[1],E=C[2],_=C[3],R=C[4],T=C[5],F=C[6],h=C[7],O=x.high,A=x.low,u=p.high,v=p.low,m=E.high,U=E.low,j=_.high,J=_.low,V=R.high,ne=R.low,he=T.high,ue=T.low,I=F.high,P=F.low,$=h.high,H=h.low,we=O,pe=A,ke=u,q=v,G=m,Ee=U,ct=j,pt=J,Ye=V,Me=ne,lt=he,Xe=ue,Tt=I,mt=P,vt=$,gr=H,rt=0;rt<80;rt++){var We,Rt,kr=f[rt];if(rt<16)Rt=kr.high=y[b+rt*2]|0,We=kr.low=y[b+rt*2+1]|0;else{var ts=f[rt-15],Ut=ts.high,tr=ts.low,bn=(Ut>>>1|tr<<31)^(Ut>>>8|tr<<24)^Ut>>>7,rs=(tr>>>1|Ut<<31)^(tr>>>8|Ut<<24)^(tr>>>7|Ut<<25),ss=f[rt-2],rr=ss.high,xr=ss.low,Cn=(rr>>>19|xr<<13)^(rr<<3|xr>>>29)^rr>>>6,Os=(xr>>>19|rr<<13)^(xr<<3|rr>>>29)^(xr>>>6|rr<<26),Ms=f[rt-7],_n=Ms.high,Dn=Ms.low,Br=f[rt-16],js=Br.high,Lt=Br.low;We=rs+Dn,Rt=bn+_n+(We>>>0<rs>>>0?1:0),We=We+Os,Rt=Rt+Cn+(We>>>0<Os>>>0?1:0),We=We+Lt,Rt=Rt+js+(We>>>0<Lt>>>0?1:0),kr.high=Rt,kr.low=We}var is=Ye<^~Ye&Tt,Ir=Me&Xe^~Me&mt,qs=we&ke^we&G^ke&G,An=pe&q^pe&Ee^q&Ee,Us=(we>>>28|pe<<4)^(we<<30|pe>>>2)^(we<<25|pe>>>7),Ls=(pe>>>28|we<<4)^(pe<<30|we>>>2)^(pe<<25|we>>>7),Ys=(Ye>>>14|Me<<18)^(Ye>>>18|Me<<14)^(Ye<<23|Me>>>9),Ws=(Me>>>14|Ye<<18)^(Me>>>18|Ye<<14)^(Me<<23|Ye>>>9),Gs=g[rt],Sn=Gs.high,ns=Gs.low,Ge=gr+Ws,Ft=vt+Ys+(Ge>>>0<gr>>>0?1:0),Ge=Ge+Ir,Ft=Ft+is+(Ge>>>0<Ir>>>0?1:0),Ge=Ge+ns,Ft=Ft+Sn+(Ge>>>0<ns>>>0?1:0),Ge=Ge+We,Ft=Ft+Rt+(Ge>>>0<We>>>0?1:0),Vs=Ls+An,Tn=Us+qs+(Vs>>>0<Ls>>>0?1:0);vt=Tt,gr=mt,Tt=lt,mt=Xe,lt=Ye,Xe=Me,Me=pt+Ge|0,Ye=ct+Ft+(Me>>>0<pt>>>0?1:0)|0,ct=G,pt=Ee,G=ke,Ee=q,ke=we,q=pe,pe=Ge+Vs|0,we=Ft+Tn+(pe>>>0<Ge>>>0?1:0)|0}A=x.low=A+pe,x.high=O+we+(A>>>0<pe>>>0?1:0),v=p.low=v+q,p.high=u+ke+(v>>>0<q>>>0?1:0),U=E.low=U+Ee,E.high=m+G+(U>>>0<Ee>>>0?1:0),J=_.low=J+pt,_.high=j+ct+(J>>>0<pt>>>0?1:0),ne=R.low=ne+Me,R.high=V+Ye+(ne>>>0<Me>>>0?1:0),ue=T.low=ue+Xe,T.high=he+lt+(ue>>>0<Xe>>>0?1:0),P=F.low=P+mt,F.high=I+Tt+(P>>>0<mt>>>0?1:0),H=h.low=H+gr,h.high=$+vt+(H>>>0<gr>>>0?1:0)},_doFinalize:function(){var y=this._data,b=y.words,C=this._nDataBytes*8,x=y.sigBytes*8;b[x>>>5]|=128<<24-x%32,b[(x+128>>>10<<5)+30]=Math.floor(C/4294967296),b[(x+128>>>10<<5)+31]=C,y.sigBytes=b.length*4,this._process();var p=this._hash.toX32();return p},clone:function(){var y=n.clone.call(this);return y._hash=this._hash.clone(),y},blockSize:1024/32});s.SHA512=n._createHelper(w),s.HmacSHA512=n._createHmacHelper(w)}(),t.SHA512})}(ai)),ai.exports}var oi={exports:{}},Xn;function g0(){return Xn||(Xn=1,function(r,e){(function(t,s,i){r.exports=s(ce(),os(),Zn())})(ie,function(t){return function(){var s=t,i=s.x64,n=i.Word,a=i.WordArray,o=s.algo,d=o.SHA512,c=o.SHA384=d.extend({_doReset:function(){this._hash=new a.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var l=d._doFinalize.call(this);return l.sigBytes-=16,l}});s.SHA384=d._createHelper(c),s.HmacSHA384=d._createHmacHelper(c)}(),t.SHA384})}(oi)),oi.exports}var ci={exports:{}},Jn;function x0(){return Jn||(Jn=1,function(r,e){(function(t,s,i){r.exports=s(ce(),os())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.x64,c=d.Word,l=i.algo,g=[],f=[],w=[];(function(){for(var C=1,x=0,p=0;p<24;p++){g[C+5*x]=(p+1)*(p+2)/2%64;var E=x%5,_=(2*C+3*x)%5;C=E,x=_}for(var C=0;C<5;C++)for(var x=0;x<5;x++)f[C+5*x]=x+(2*C+3*x)%5*5;for(var R=1,T=0;T<24;T++){for(var F=0,h=0,O=0;O<7;O++){if(R&1){var A=(1<<O)-1;A<32?h^=1<<A:F^=1<<A-32}R&128?R=R<<1^113:R<<=1}w[T]=c.create(F,h)}})();var y=[];(function(){for(var C=0;C<25;C++)y[C]=c.create()})();var b=l.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var C=this._state=[],x=0;x<25;x++)C[x]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(C,x){for(var p=this._state,E=this.blockSize/2,_=0;_<E;_++){var R=C[x+2*_],T=C[x+2*_+1];R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360;var F=p[_];F.high^=T,F.low^=R}for(var h=0;h<24;h++){for(var O=0;O<5;O++){for(var A=0,u=0,v=0;v<5;v++){var F=p[O+5*v];A^=F.high,u^=F.low}var m=y[O];m.high=A,m.low=u}for(var O=0;O<5;O++)for(var U=y[(O+4)%5],j=y[(O+1)%5],J=j.high,V=j.low,A=U.high^(J<<1|V>>>31),u=U.low^(V<<1|J>>>31),v=0;v<5;v++){var F=p[O+5*v];F.high^=A,F.low^=u}for(var ne=1;ne<25;ne++){var A,u,F=p[ne],he=F.high,ue=F.low,I=g[ne];I<32?(A=he<<I|ue>>>32-I,u=ue<<I|he>>>32-I):(A=ue<<I-32|he>>>64-I,u=he<<I-32|ue>>>64-I);var P=y[f[ne]];P.high=A,P.low=u}var $=y[0],H=p[0];$.high=H.high,$.low=H.low;for(var O=0;O<5;O++)for(var v=0;v<5;v++){var ne=O+5*v,F=p[ne],we=y[ne],pe=y[(O+1)%5+5*v],ke=y[(O+2)%5+5*v];F.high=we.high^~pe.high&ke.high,F.low=we.low^~pe.low&ke.low}var F=p[0],q=w[h];F.high^=q.high,F.low^=q.low}},_doFinalize:function(){var C=this._data,x=C.words;this._nDataBytes*8;var p=C.sigBytes*8,E=this.blockSize*32;x[p>>>5]|=1<<24-p%32,x[(s.ceil((p+1)/E)*E>>>5)-1]|=128,C.sigBytes=x.length*4,this._process();for(var _=this._state,R=this.cfg.outputLength/8,T=R/8,F=[],h=0;h<T;h++){var O=_[h],A=O.high,u=O.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,u=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360,F.push(u),F.push(A)}return new a.init(F,R)},clone:function(){for(var C=o.clone.call(this),x=C._state=this._state.slice(0),p=0;p<25;p++)x[p]=x[p].clone();return C}});i.SHA3=o._createHelper(b),i.HmacSHA3=o._createHmacHelper(b)}(Math),t.SHA3})}(ci)),ci.exports}var li={exports:{}},Qn;function p0(){return Qn||(Qn=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){/** @preserve
|
|
131
131
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
132
132
|
|
|
133
133
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
@@ -136,11 +136,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
136
136
|
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
137
137
|
|
|
138
138
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
139
|
-
*/return function(s){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),y=a.create([0,1518500249,1859775393,2400959708,2840853838]),w=a.create([1352829926,1548603684,1836072691,2053994217,0]),b=d.RIPEMD160=o.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(T,F){for(var h=0;h<16;h++){var O=F+h,A=T[O];T[O]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var f=this._hash.words,v=y.words,m=w.words,U=c.words,j=l.words,X=g.words,G=u.words,ne,he,ue,I,H,$,P,we,pe,ke;$=ne=f[0],P=he=f[1],we=ue=f[2],pe=I=f[3],ke=H=f[4];for(var q,h=0;h<80;h+=1)q=ne+T[F+U[h]]|0,h<16?q+=C(he,ue,I)+v[0]:h<32?q+=x(he,ue,I)+v[1]:h<48?q+=p(he,ue,I)+v[2]:h<64?q+=E(he,ue,I)+v[3]:q+=_(he,ue,I)+v[4],q=q|0,q=R(q,X[h]),q=q+H|0,ne=H,H=I,I=R(ue,10),ue=he,he=q,q=$+T[F+j[h]]|0,h<16?q+=_(P,we,pe)+m[0]:h<32?q+=E(P,we,pe)+m[1]:h<48?q+=p(P,we,pe)+m[2]:h<64?q+=x(P,we,pe)+m[3]:q+=C(P,we,pe)+m[4],q=q|0,q=R(q,G[h]),q=q+ke|0,$=ke,ke=pe,pe=R(we,10),we=P,P=q;q=f[1]+ue+pe|0,f[1]=f[2]+I+ke|0,f[2]=f[3]+H+$|0,f[3]=f[4]+ne+P|0,f[4]=f[0]+he+we|0,f[0]=q},_doFinalize:function(){var T=this._data,F=T.words,h=this._nDataBytes*8,O=T.sigBytes*8;F[O>>>5]|=128<<24-O%32,F[(O+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,T.sigBytes=(F.length+1)*4,this._process();for(var A=this._hash,f=A.words,v=0;v<5;v++){var m=f[v];f[v]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}return A},clone:function(){var T=o.clone.call(this);return T._hash=this._hash.clone(),T}});function C(T,F,h){return T^F^h}function x(T,F,h){return T&F|~T&h}function p(T,F,h){return(T|~F)^h}function E(T,F,h){return T&h|F&~h}function _(T,F,h){return T^(F|~h)}function R(T,F){return T<<F|T>>>32-F}i.RIPEMD160=o._createHelper(b),i.HmacRIPEMD160=o._createHmacHelper(b)}(),t.RIPEMD160})}(li)),li.exports}var di={exports:{}},ea;function hi(){return ea||(ea=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){(function(){var s=t,i=s.lib,n=i.Base,a=s.enc,o=a.Utf8,d=s.algo;d.HMAC=n.extend({init:function(c,l){c=this._hasher=new c.init,typeof l=="string"&&(l=o.parse(l));var g=c.blockSize,u=g*4;l.sigBytes>u&&(l=c.finalize(l)),l.clamp();for(var y=this._oKey=l.clone(),w=this._iKey=l.clone(),b=y.words,C=w.words,x=0;x<g;x++)b[x]^=1549556828,C[x]^=909522486;y.sigBytes=w.sigBytes=u,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var l=this._hasher,g=l.finalize(c);l.reset();var u=l.finalize(this._oKey.clone().concat(g));return u}})})()})}(di)),di.exports}var ui={exports:{}},ta;function m0(){return ta||(ta=1,function(r,e){(function(t,s,i){r.exports=s(ce(),ii(),hi())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.Base,a=i.WordArray,o=s.algo,d=o.SHA256,c=o.HMAC,l=o.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:d,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,u){for(var y=this.cfg,w=c.create(y.hasher,g),b=a.create(),C=a.create([1]),x=b.words,p=C.words,E=y.keySize,_=y.iterations;x.length<E;){var R=w.update(u).finalize(C);w.reset();for(var T=R.words,F=T.length,h=R,O=1;O<_;O++){h=w.finalize(h),w.reset();for(var A=h.words,f=0;f<F;f++)T[f]^=A[f]}b.concat(R),p[0]++}return b.sigBytes=E*4,b}});s.PBKDF2=function(g,u,y){return l.create(y).compute(g,u)}}(),t.PBKDF2})}(ui)),ui.exports}var fi={exports:{}},ra;function Wt(){return ra||(ra=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Gn(),hi())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.Base,a=i.WordArray,o=s.algo,d=o.MD5,c=o.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:d,iterations:1}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,g){for(var u,y=this.cfg,w=y.hasher.create(),b=a.create(),C=b.words,x=y.keySize,p=y.iterations;C.length<x;){u&&w.update(u),u=w.update(l).finalize(g),w.reset();for(var E=1;E<p;E++)u=w.finalize(u),w.reset();b.concat(u)}return b.sigBytes=x*4,b}});s.EvpKDF=function(l,g,u){return c.create(u).compute(l,g)}}(),t.EvpKDF})}(fi)),fi.exports}var gi={exports:{}},sa;function He(){return sa||(sa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Wt())})(ie,function(t){t.lib.Cipher||function(s){var i=t,n=i.lib,a=n.Base,o=n.WordArray,d=n.BufferedBlockAlgorithm,c=i.enc;c.Utf8;var l=c.Base64,g=i.algo,u=g.EvpKDF,y=n.Cipher=d.extend({cfg:a.extend(),createEncryptor:function(A,f){return this.create(this._ENC_XFORM_MODE,A,f)},createDecryptor:function(A,f){return this.create(this._DEC_XFORM_MODE,A,f)},init:function(A,f,v){this.cfg=this.cfg.extend(v),this._xformMode=A,this._key=f,this.reset()},reset:function(){d.reset.call(this),this._doReset()},process:function(A){return this._append(A),this._process()},finalize:function(A){A&&this._append(A);var f=this._doFinalize();return f},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(f){return typeof f=="string"?O:T}return function(f){return{encrypt:function(v,m,U){return A(m).encrypt(f,v,m,U)},decrypt:function(v,m,U){return A(m).decrypt(f,v,m,U)}}}}()});n.StreamCipher=y.extend({_doFinalize:function(){var A=this._process(!0);return A},blockSize:1});var w=i.mode={},b=n.BlockCipherMode=a.extend({createEncryptor:function(A,f){return this.Encryptor.create(A,f)},createDecryptor:function(A,f){return this.Decryptor.create(A,f)},init:function(A,f){this._cipher=A,this._iv=f}}),C=w.CBC=function(){var A=b.extend();A.Encryptor=A.extend({processBlock:function(v,m){var U=this._cipher,j=U.blockSize;f.call(this,v,m,j),U.encryptBlock(v,m),this._prevBlock=v.slice(m,m+j)}}),A.Decryptor=A.extend({processBlock:function(v,m){var U=this._cipher,j=U.blockSize,X=v.slice(m,m+j);U.decryptBlock(v,m),f.call(this,v,m,j),this._prevBlock=X}});function f(v,m,U){var j,X=this._iv;X?(j=X,this._iv=s):j=this._prevBlock;for(var G=0;G<U;G++)v[m+G]^=j[G]}return A}(),x=i.pad={},p=x.Pkcs7={pad:function(A,f){for(var v=f*4,m=v-A.sigBytes%v,U=m<<24|m<<16|m<<8|m,j=[],X=0;X<m;X+=4)j.push(U);var G=o.create(j,m);A.concat(G)},unpad:function(A){var f=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=f}};n.BlockCipher=y.extend({cfg:y.cfg.extend({mode:C,padding:p}),reset:function(){var A;y.reset.call(this);var f=this.cfg,v=f.iv,m=f.mode;this._xformMode==this._ENC_XFORM_MODE?A=m.createEncryptor:(A=m.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==A?this._mode.init(this,v&&v.words):(this._mode=A.call(m,this,v&&v.words),this._mode.__creator=A)},_doProcessBlock:function(A,f){this._mode.processBlock(A,f)},_doFinalize:function(){var A,f=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(f.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),f.unpad(A)),A},blockSize:128/32});var E=n.CipherParams=a.extend({init:function(A){this.mixIn(A)},toString:function(A){return(A||this.formatter).stringify(this)}}),_=i.format={},R=_.OpenSSL={stringify:function(A){var f,v=A.ciphertext,m=A.salt;return m?f=o.create([1398893684,1701076831]).concat(m).concat(v):f=v,f.toString(l)},parse:function(A){var f,v=l.parse(A),m=v.words;return m[0]==1398893684&&m[1]==1701076831&&(f=o.create(m.slice(2,4)),m.splice(0,4),v.sigBytes-=16),E.create({ciphertext:v,salt:f})}},T=n.SerializableCipher=a.extend({cfg:a.extend({format:R}),encrypt:function(A,f,v,m){m=this.cfg.extend(m);var U=A.createEncryptor(v,m),j=U.finalize(f),X=U.cfg;return E.create({ciphertext:j,key:v,iv:X.iv,algorithm:A,mode:X.mode,padding:X.padding,blockSize:A.blockSize,formatter:m.format})},decrypt:function(A,f,v,m){m=this.cfg.extend(m),f=this._parse(f,m.format);var U=A.createDecryptor(v,m).finalize(f.ciphertext);return U},_parse:function(A,f){return typeof A=="string"?f.parse(A,this):A}}),F=i.kdf={},h=F.OpenSSL={execute:function(A,f,v,m,U){if(m||(m=o.random(64/8)),U)var j=u.create({keySize:f+v,hasher:U}).compute(A,m);else var j=u.create({keySize:f+v}).compute(A,m);var X=o.create(j.words.slice(f),v*4);return j.sigBytes=f*4,E.create({key:j,iv:X,salt:m})}},O=n.PasswordBasedCipher=T.extend({cfg:T.cfg.extend({kdf:h}),encrypt:function(A,f,v,m){m=this.cfg.extend(m);var U=m.kdf.execute(v,A.keySize,A.ivSize,m.salt,m.hasher);m.iv=U.iv;var j=T.encrypt.call(this,A,f,U.key,m);return j.mixIn(U),j},decrypt:function(A,f,v,m){m=this.cfg.extend(m),f=this._parse(f,m.format);var U=m.kdf.execute(v,A.keySize,A.ivSize,f.salt,m.hasher);m.iv=U.iv;var j=T.decrypt.call(this,A,f,U.key,m);return j}})}()})}(gi)),gi.exports}var xi={exports:{}},ia;function v0(){return ia||(ia=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.mode.CFB=function(){var s=t.lib.BlockCipherMode.extend();s.Encryptor=s.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize;i.call(this,n,a,d,o),this._prevBlock=n.slice(a,a+d)}}),s.Decryptor=s.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=n.slice(a,a+d);i.call(this,n,a,d,o),this._prevBlock=c}});function i(n,a,o,d){var c,l=this._iv;l?(c=l.slice(0),this._iv=void 0):c=this._prevBlock,d.encryptBlock(c,0);for(var g=0;g<o;g++)n[a+g]^=c[g]}return s}(),t.mode.CFB})}(xi)),xi.exports}var pi={exports:{}},na;function y0(){return na||(na=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.mode.CTR=function(){var s=t.lib.BlockCipherMode.extend(),i=s.Encryptor=s.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=this._iv,l=this._counter;c&&(l=this._counter=c.slice(0),this._iv=void 0);var g=l.slice(0);o.encryptBlock(g,0),l[d-1]=l[d-1]+1|0;for(var u=0;u<d;u++)n[a+u]^=g[u]}});return s.Decryptor=i,s}(),t.mode.CTR})}(pi)),pi.exports}var mi={exports:{}},aa;function w0(){return aa||(aa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){/** @preserve
|
|
139
|
+
*/return function(s){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,d=i.algo,c=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),w=a.create([0,1518500249,1859775393,2400959708,2840853838]),y=a.create([1352829926,1548603684,1836072691,2053994217,0]),b=d.RIPEMD160=o.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(T,F){for(var h=0;h<16;h++){var O=F+h,A=T[O];T[O]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var u=this._hash.words,v=w.words,m=y.words,U=c.words,j=l.words,J=g.words,V=f.words,ne,he,ue,I,P,$,H,we,pe,ke;$=ne=u[0],H=he=u[1],we=ue=u[2],pe=I=u[3],ke=P=u[4];for(var q,h=0;h<80;h+=1)q=ne+T[F+U[h]]|0,h<16?q+=C(he,ue,I)+v[0]:h<32?q+=x(he,ue,I)+v[1]:h<48?q+=p(he,ue,I)+v[2]:h<64?q+=E(he,ue,I)+v[3]:q+=_(he,ue,I)+v[4],q=q|0,q=R(q,J[h]),q=q+P|0,ne=P,P=I,I=R(ue,10),ue=he,he=q,q=$+T[F+j[h]]|0,h<16?q+=_(H,we,pe)+m[0]:h<32?q+=E(H,we,pe)+m[1]:h<48?q+=p(H,we,pe)+m[2]:h<64?q+=x(H,we,pe)+m[3]:q+=C(H,we,pe)+m[4],q=q|0,q=R(q,V[h]),q=q+ke|0,$=ke,ke=pe,pe=R(we,10),we=H,H=q;q=u[1]+ue+pe|0,u[1]=u[2]+I+ke|0,u[2]=u[3]+P+$|0,u[3]=u[4]+ne+H|0,u[4]=u[0]+he+we|0,u[0]=q},_doFinalize:function(){var T=this._data,F=T.words,h=this._nDataBytes*8,O=T.sigBytes*8;F[O>>>5]|=128<<24-O%32,F[(O+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,T.sigBytes=(F.length+1)*4,this._process();for(var A=this._hash,u=A.words,v=0;v<5;v++){var m=u[v];u[v]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}return A},clone:function(){var T=o.clone.call(this);return T._hash=this._hash.clone(),T}});function C(T,F,h){return T^F^h}function x(T,F,h){return T&F|~T&h}function p(T,F,h){return(T|~F)^h}function E(T,F,h){return T&h|F&~h}function _(T,F,h){return T^(F|~h)}function R(T,F){return T<<F|T>>>32-F}i.RIPEMD160=o._createHelper(b),i.HmacRIPEMD160=o._createHmacHelper(b)}(),t.RIPEMD160})}(li)),li.exports}var di={exports:{}},ea;function hi(){return ea||(ea=1,function(r,e){(function(t,s){r.exports=s(ce())})(ie,function(t){(function(){var s=t,i=s.lib,n=i.Base,a=s.enc,o=a.Utf8,d=s.algo;d.HMAC=n.extend({init:function(c,l){c=this._hasher=new c.init,typeof l=="string"&&(l=o.parse(l));var g=c.blockSize,f=g*4;l.sigBytes>f&&(l=c.finalize(l)),l.clamp();for(var w=this._oKey=l.clone(),y=this._iKey=l.clone(),b=w.words,C=y.words,x=0;x<g;x++)b[x]^=1549556828,C[x]^=909522486;w.sigBytes=y.sigBytes=f,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var l=this._hasher,g=l.finalize(c);l.reset();var f=l.finalize(this._oKey.clone().concat(g));return f}})})()})}(di)),di.exports}var ui={exports:{}},ta;function m0(){return ta||(ta=1,function(r,e){(function(t,s,i){r.exports=s(ce(),ii(),hi())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.Base,a=i.WordArray,o=s.algo,d=o.SHA256,c=o.HMAC,l=o.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:d,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,f){for(var w=this.cfg,y=c.create(w.hasher,g),b=a.create(),C=a.create([1]),x=b.words,p=C.words,E=w.keySize,_=w.iterations;x.length<E;){var R=y.update(f).finalize(C);y.reset();for(var T=R.words,F=T.length,h=R,O=1;O<_;O++){h=y.finalize(h),y.reset();for(var A=h.words,u=0;u<F;u++)T[u]^=A[u]}b.concat(R),p[0]++}return b.sigBytes=E*4,b}});s.PBKDF2=function(g,f,w){return l.create(w).compute(g,f)}}(),t.PBKDF2})}(ui)),ui.exports}var fi={exports:{}},ra;function Wt(){return ra||(ra=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Gn(),hi())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.Base,a=i.WordArray,o=s.algo,d=o.MD5,c=o.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:d,iterations:1}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,g){for(var f,w=this.cfg,y=w.hasher.create(),b=a.create(),C=b.words,x=w.keySize,p=w.iterations;C.length<x;){f&&y.update(f),f=y.update(l).finalize(g),y.reset();for(var E=1;E<p;E++)f=y.finalize(f),y.reset();b.concat(f)}return b.sigBytes=x*4,b}});s.EvpKDF=function(l,g,f){return c.create(f).compute(l,g)}}(),t.EvpKDF})}(fi)),fi.exports}var gi={exports:{}},sa;function Pe(){return sa||(sa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Wt())})(ie,function(t){t.lib.Cipher||function(s){var i=t,n=i.lib,a=n.Base,o=n.WordArray,d=n.BufferedBlockAlgorithm,c=i.enc;c.Utf8;var l=c.Base64,g=i.algo,f=g.EvpKDF,w=n.Cipher=d.extend({cfg:a.extend(),createEncryptor:function(A,u){return this.create(this._ENC_XFORM_MODE,A,u)},createDecryptor:function(A,u){return this.create(this._DEC_XFORM_MODE,A,u)},init:function(A,u,v){this.cfg=this.cfg.extend(v),this._xformMode=A,this._key=u,this.reset()},reset:function(){d.reset.call(this),this._doReset()},process:function(A){return this._append(A),this._process()},finalize:function(A){A&&this._append(A);var u=this._doFinalize();return u},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(u){return typeof u=="string"?O:T}return function(u){return{encrypt:function(v,m,U){return A(m).encrypt(u,v,m,U)},decrypt:function(v,m,U){return A(m).decrypt(u,v,m,U)}}}}()});n.StreamCipher=w.extend({_doFinalize:function(){var A=this._process(!0);return A},blockSize:1});var y=i.mode={},b=n.BlockCipherMode=a.extend({createEncryptor:function(A,u){return this.Encryptor.create(A,u)},createDecryptor:function(A,u){return this.Decryptor.create(A,u)},init:function(A,u){this._cipher=A,this._iv=u}}),C=y.CBC=function(){var A=b.extend();A.Encryptor=A.extend({processBlock:function(v,m){var U=this._cipher,j=U.blockSize;u.call(this,v,m,j),U.encryptBlock(v,m),this._prevBlock=v.slice(m,m+j)}}),A.Decryptor=A.extend({processBlock:function(v,m){var U=this._cipher,j=U.blockSize,J=v.slice(m,m+j);U.decryptBlock(v,m),u.call(this,v,m,j),this._prevBlock=J}});function u(v,m,U){var j,J=this._iv;J?(j=J,this._iv=s):j=this._prevBlock;for(var V=0;V<U;V++)v[m+V]^=j[V]}return A}(),x=i.pad={},p=x.Pkcs7={pad:function(A,u){for(var v=u*4,m=v-A.sigBytes%v,U=m<<24|m<<16|m<<8|m,j=[],J=0;J<m;J+=4)j.push(U);var V=o.create(j,m);A.concat(V)},unpad:function(A){var u=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=u}};n.BlockCipher=w.extend({cfg:w.cfg.extend({mode:C,padding:p}),reset:function(){var A;w.reset.call(this);var u=this.cfg,v=u.iv,m=u.mode;this._xformMode==this._ENC_XFORM_MODE?A=m.createEncryptor:(A=m.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==A?this._mode.init(this,v&&v.words):(this._mode=A.call(m,this,v&&v.words),this._mode.__creator=A)},_doProcessBlock:function(A,u){this._mode.processBlock(A,u)},_doFinalize:function(){var A,u=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(u.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),u.unpad(A)),A},blockSize:128/32});var E=n.CipherParams=a.extend({init:function(A){this.mixIn(A)},toString:function(A){return(A||this.formatter).stringify(this)}}),_=i.format={},R=_.OpenSSL={stringify:function(A){var u,v=A.ciphertext,m=A.salt;return m?u=o.create([1398893684,1701076831]).concat(m).concat(v):u=v,u.toString(l)},parse:function(A){var u,v=l.parse(A),m=v.words;return m[0]==1398893684&&m[1]==1701076831&&(u=o.create(m.slice(2,4)),m.splice(0,4),v.sigBytes-=16),E.create({ciphertext:v,salt:u})}},T=n.SerializableCipher=a.extend({cfg:a.extend({format:R}),encrypt:function(A,u,v,m){m=this.cfg.extend(m);var U=A.createEncryptor(v,m),j=U.finalize(u),J=U.cfg;return E.create({ciphertext:j,key:v,iv:J.iv,algorithm:A,mode:J.mode,padding:J.padding,blockSize:A.blockSize,formatter:m.format})},decrypt:function(A,u,v,m){m=this.cfg.extend(m),u=this._parse(u,m.format);var U=A.createDecryptor(v,m).finalize(u.ciphertext);return U},_parse:function(A,u){return typeof A=="string"?u.parse(A,this):A}}),F=i.kdf={},h=F.OpenSSL={execute:function(A,u,v,m,U){if(m||(m=o.random(64/8)),U)var j=f.create({keySize:u+v,hasher:U}).compute(A,m);else var j=f.create({keySize:u+v}).compute(A,m);var J=o.create(j.words.slice(u),v*4);return j.sigBytes=u*4,E.create({key:j,iv:J,salt:m})}},O=n.PasswordBasedCipher=T.extend({cfg:T.cfg.extend({kdf:h}),encrypt:function(A,u,v,m){m=this.cfg.extend(m);var U=m.kdf.execute(v,A.keySize,A.ivSize,m.salt,m.hasher);m.iv=U.iv;var j=T.encrypt.call(this,A,u,U.key,m);return j.mixIn(U),j},decrypt:function(A,u,v,m){m=this.cfg.extend(m),u=this._parse(u,m.format);var U=m.kdf.execute(v,A.keySize,A.ivSize,u.salt,m.hasher);m.iv=U.iv;var j=T.decrypt.call(this,A,u,U.key,m);return j}})}()})}(gi)),gi.exports}var xi={exports:{}},ia;function v0(){return ia||(ia=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.mode.CFB=function(){var s=t.lib.BlockCipherMode.extend();s.Encryptor=s.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize;i.call(this,n,a,d,o),this._prevBlock=n.slice(a,a+d)}}),s.Decryptor=s.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=n.slice(a,a+d);i.call(this,n,a,d,o),this._prevBlock=c}});function i(n,a,o,d){var c,l=this._iv;l?(c=l.slice(0),this._iv=void 0):c=this._prevBlock,d.encryptBlock(c,0);for(var g=0;g<o;g++)n[a+g]^=c[g]}return s}(),t.mode.CFB})}(xi)),xi.exports}var pi={exports:{}},na;function y0(){return na||(na=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.mode.CTR=function(){var s=t.lib.BlockCipherMode.extend(),i=s.Encryptor=s.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=this._iv,l=this._counter;c&&(l=this._counter=c.slice(0),this._iv=void 0);var g=l.slice(0);o.encryptBlock(g,0),l[d-1]=l[d-1]+1|0;for(var f=0;f<d;f++)n[a+f]^=g[f]}});return s.Decryptor=i,s}(),t.mode.CTR})}(pi)),pi.exports}var mi={exports:{}},aa;function w0(){return aa||(aa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){/** @preserve
|
|
140
140
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
141
141
|
* derived from CryptoJS.mode.CTR
|
|
142
142
|
* Jan Hruby jhruby.web@gmail.com
|
|
143
|
-
*/return t.mode.CTRGladman=function(){var s=t.lib.BlockCipherMode.extend();function i(o){if((o>>24&255)===255){var d=o>>16&255,c=o>>8&255,l=o&255;d===255?(d=0,c===255?(c=0,l===255?l=0:++l):++c):++d,o=0,o+=d<<16,o+=c<<8,o+=l}else o+=1<<24;return o}function n(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var a=s.Encryptor=s.extend({processBlock:function(o,d){var c=this._cipher,l=c.blockSize,g=this._iv,u=this._counter;g&&(u=this._counter=g.slice(0),this._iv=void 0),n(u);var y=u.slice(0);c.encryptBlock(y,0);for(var w=0;w<l;w++)o[d+w]^=y[w]}});return s.Decryptor=a,s}(),t.mode.CTRGladman})}(mi)),mi.exports}var vi={exports:{}},oa;function E0(){return oa||(oa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.mode.OFB=function(){var s=t.lib.BlockCipherMode.extend(),i=s.Encryptor=s.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=this._iv,l=this._keystream;c&&(l=this._keystream=c.slice(0),this._iv=void 0),o.encryptBlock(l,0);for(var g=0;g<d;g++)n[a+g]^=l[g]}});return s.Decryptor=i,s}(),t.mode.OFB})}(vi)),vi.exports}var yi={exports:{}},ca;function b0(){return ca||(ca=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.mode.ECB=function(){var s=t.lib.BlockCipherMode.extend();return s.Encryptor=s.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),s.Decryptor=s.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),s}(),t.mode.ECB})}(yi)),yi.exports}var wi={exports:{}},la;function C0(){return la||(la=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.pad.AnsiX923={pad:function(s,i){var n=s.sigBytes,a=i*4,o=a-n%a,d=n+o-1;s.clamp(),s.words[d>>>2]|=o<<24-d%4*8,s.sigBytes+=o},unpad:function(s){var i=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=i}},t.pad.Ansix923})}(wi)),wi.exports}var Ei={exports:{}},da;function _0(){return da||(da=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.pad.Iso10126={pad:function(s,i){var n=i*4,a=n-s.sigBytes%n;s.concat(t.lib.WordArray.random(a-1)).concat(t.lib.WordArray.create([a<<24],1))},unpad:function(s){var i=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=i}},t.pad.Iso10126})}(Ei)),Ei.exports}var bi={exports:{}},ha;function D0(){return ha||(ha=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.pad.Iso97971={pad:function(s,i){s.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(s,i)},unpad:function(s){t.pad.ZeroPadding.unpad(s),s.sigBytes--}},t.pad.Iso97971})}(bi)),bi.exports}var Ci={exports:{}},ua;function A0(){return ua||(ua=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.pad.ZeroPadding={pad:function(s,i){var n=i*4;s.clamp(),s.sigBytes+=n-(s.sigBytes%n||n)},unpad:function(s){for(var i=s.words,n=s.sigBytes-1,n=s.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){s.sigBytes=n+1;break}}},t.pad.ZeroPadding})}(Ci)),Ci.exports}var _i={exports:{}},fa;function S0(){return fa||(fa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}(_i)),_i.exports}var Di={exports:{}},ga;function T0(){return ga||(ga=1,function(r,e){(function(t,s,i){r.exports=s(ce(),He())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.CipherParams,o=i.enc,d=o.Hex,c=i.format;c.Hex={stringify:function(l){return l.ciphertext.toString(d)},parse:function(l){var g=d.parse(l);return a.create({ciphertext:g})}}}(),t.format.Hex})}(Di)),Di.exports}var Ai={exports:{}},xa;function R0(){return xa||(xa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),He())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.BlockCipher,a=s.algo,o=[],d=[],c=[],l=[],g=[],u=[],y=[],w=[],b=[],C=[];(function(){for(var E=[],_=0;_<256;_++)_<128?E[_]=_<<1:E[_]=_<<1^283;for(var R=0,T=0,_=0;_<256;_++){var F=T^T<<1^T<<2^T<<3^T<<4;F=F>>>8^F&255^99,o[R]=F,d[F]=R;var h=E[R],O=E[h],A=E[O],f=E[F]*257^F*16843008;c[R]=f<<24|f>>>8,l[R]=f<<16|f>>>16,g[R]=f<<8|f>>>24,u[R]=f;var f=A*16843009^O*65537^h*257^R*16843008;y[F]=f<<24|f>>>8,w[F]=f<<16|f>>>16,b[F]=f<<8|f>>>24,C[F]=f,R?(R=h^E[E[E[A^h]]],T^=E[E[T]]):R=T=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],p=a.AES=n.extend({_doReset:function(){var E;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,R=_.words,T=_.sigBytes/4,F=this._nRounds=T+6,h=(F+1)*4,O=this._keySchedule=[],A=0;A<h;A++)A<T?O[A]=R[A]:(E=O[A-1],A%T?T>6&&A%T==4&&(E=o[E>>>24]<<24|o[E>>>16&255]<<16|o[E>>>8&255]<<8|o[E&255]):(E=E<<8|E>>>24,E=o[E>>>24]<<24|o[E>>>16&255]<<16|o[E>>>8&255]<<8|o[E&255],E^=x[A/T|0]<<24),O[A]=O[A-T]^E);for(var f=this._invKeySchedule=[],v=0;v<h;v++){var A=h-v;if(v%4)var E=O[A];else var E=O[A-4];v<4||A<=4?f[v]=E:f[v]=y[o[E>>>24]]^w[o[E>>>16&255]]^b[o[E>>>8&255]]^C[o[E&255]]}}},encryptBlock:function(E,_){this._doCryptBlock(E,_,this._keySchedule,c,l,g,u,o)},decryptBlock:function(E,_){var R=E[_+1];E[_+1]=E[_+3],E[_+3]=R,this._doCryptBlock(E,_,this._invKeySchedule,y,w,b,C,d);var R=E[_+1];E[_+1]=E[_+3],E[_+3]=R},_doCryptBlock:function(E,_,R,T,F,h,O,A){for(var f=this._nRounds,v=E[_]^R[0],m=E[_+1]^R[1],U=E[_+2]^R[2],j=E[_+3]^R[3],X=4,G=1;G<f;G++){var ne=T[v>>>24]^F[m>>>16&255]^h[U>>>8&255]^O[j&255]^R[X++],he=T[m>>>24]^F[U>>>16&255]^h[j>>>8&255]^O[v&255]^R[X++],ue=T[U>>>24]^F[j>>>16&255]^h[v>>>8&255]^O[m&255]^R[X++],I=T[j>>>24]^F[v>>>16&255]^h[m>>>8&255]^O[U&255]^R[X++];v=ne,m=he,U=ue,j=I}var ne=(A[v>>>24]<<24|A[m>>>16&255]<<16|A[U>>>8&255]<<8|A[j&255])^R[X++],he=(A[m>>>24]<<24|A[U>>>16&255]<<16|A[j>>>8&255]<<8|A[v&255])^R[X++],ue=(A[U>>>24]<<24|A[j>>>16&255]<<16|A[v>>>8&255]<<8|A[m&255])^R[X++],I=(A[j>>>24]<<24|A[v>>>16&255]<<16|A[m>>>8&255]<<8|A[U&255])^R[X++];E[_]=ne,E[_+1]=he,E[_+2]=ue,E[_+3]=I},keySize:256/32});s.AES=n._createHelper(p)}(),t.AES})}(Ai)),Ai.exports}var Si={exports:{}},pa;function F0(){return pa||(pa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),He())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=i.BlockCipher,o=s.algo,d=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],g=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],y=o.DES=a.extend({_doReset:function(){for(var x=this._key,p=x.words,E=[],_=0;_<56;_++){var R=d[_]-1;E[_]=p[R>>>5]>>>31-R%32&1}for(var T=this._subKeys=[],F=0;F<16;F++){for(var h=T[F]=[],O=l[F],_=0;_<24;_++)h[_/6|0]|=E[(c[_]-1+O)%28]<<31-_%6,h[4+(_/6|0)]|=E[28+(c[_+24]-1+O)%28]<<31-_%6;h[0]=h[0]<<1|h[0]>>>31;for(var _=1;_<7;_++)h[_]=h[_]>>>(_-1)*4+3;h[7]=h[7]<<5|h[7]>>>27}for(var A=this._invSubKeys=[],_=0;_<16;_++)A[_]=T[15-_]},encryptBlock:function(x,p){this._doCryptBlock(x,p,this._subKeys)},decryptBlock:function(x,p){this._doCryptBlock(x,p,this._invSubKeys)},_doCryptBlock:function(x,p,E){this._lBlock=x[p],this._rBlock=x[p+1],w.call(this,4,252645135),w.call(this,16,65535),b.call(this,2,858993459),b.call(this,8,16711935),w.call(this,1,1431655765);for(var _=0;_<16;_++){for(var R=E[_],T=this._lBlock,F=this._rBlock,h=0,O=0;O<8;O++)h|=g[O][((F^R[O])&u[O])>>>0];this._lBlock=F,this._rBlock=T^h}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,w.call(this,1,1431655765),b.call(this,8,16711935),b.call(this,2,858993459),w.call(this,16,65535),w.call(this,4,252645135),x[p]=this._lBlock,x[p+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function w(x,p){var E=(this._lBlock>>>x^this._rBlock)&p;this._rBlock^=E,this._lBlock^=E<<x}function b(x,p){var E=(this._rBlock>>>x^this._lBlock)&p;this._lBlock^=E,this._rBlock^=E<<x}s.DES=a._createHelper(y);var C=o.TripleDES=a.extend({_doReset:function(){var x=this._key,p=x.words;if(p.length!==2&&p.length!==4&&p.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var E=p.slice(0,2),_=p.length<4?p.slice(0,2):p.slice(2,4),R=p.length<6?p.slice(0,2):p.slice(4,6);this._des1=y.createEncryptor(n.create(E)),this._des2=y.createEncryptor(n.create(_)),this._des3=y.createEncryptor(n.create(R))},encryptBlock:function(x,p){this._des1.encryptBlock(x,p),this._des2.decryptBlock(x,p),this._des3.encryptBlock(x,p)},decryptBlock:function(x,p){this._des3.decryptBlock(x,p),this._des2.encryptBlock(x,p),this._des1.decryptBlock(x,p)},keySize:192/32,ivSize:64/32,blockSize:64/32});s.TripleDES=a._createHelper(C)}(),t.TripleDES})}(Si)),Si.exports}var Ti={exports:{}},ma;function k0(){return ma||(ma=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),He())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.StreamCipher,a=s.algo,o=a.RC4=n.extend({_doReset:function(){for(var l=this._key,g=l.words,u=l.sigBytes,y=this._S=[],w=0;w<256;w++)y[w]=w;for(var w=0,b=0;w<256;w++){var C=w%u,x=g[C>>>2]>>>24-C%4*8&255;b=(b+y[w]+x)%256;var p=y[w];y[w]=y[b],y[b]=p}this._i=this._j=0},_doProcessBlock:function(l,g){l[g]^=d.call(this)},keySize:256/32,ivSize:0});function d(){for(var l=this._S,g=this._i,u=this._j,y=0,w=0;w<4;w++){g=(g+1)%256,u=(u+l[g])%256;var b=l[g];l[g]=l[u],l[u]=b,y|=l[(l[g]+l[u])%256]<<24-w*8}return this._i=g,this._j=u,y}s.RC4=n._createHelper(o);var c=a.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var l=this.cfg.drop;l>0;l--)d.call(this)}});s.RC4Drop=n._createHelper(c)}(),t.RC4})}(Ti)),Ti.exports}var Ri={exports:{}},va;function B0(){return va||(va=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),He())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.StreamCipher,a=s.algo,o=[],d=[],c=[],l=a.Rabbit=n.extend({_doReset:function(){for(var u=this._key.words,y=this.cfg.iv,w=0;w<4;w++)u[w]=(u[w]<<8|u[w]>>>24)&16711935|(u[w]<<24|u[w]>>>8)&4278255360;var b=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],C=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var w=0;w<4;w++)g.call(this);for(var w=0;w<8;w++)C[w]^=b[w+4&7];if(y){var x=y.words,p=x[0],E=x[1],_=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,R=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,T=_>>>16|R&4294901760,F=R<<16|_&65535;C[0]^=_,C[1]^=T,C[2]^=R,C[3]^=F,C[4]^=_,C[5]^=T,C[6]^=R,C[7]^=F;for(var w=0;w<4;w++)g.call(this)}},_doProcessBlock:function(u,y){var w=this._X;g.call(this),o[0]=w[0]^w[5]>>>16^w[3]<<16,o[1]=w[2]^w[7]>>>16^w[5]<<16,o[2]=w[4]^w[1]>>>16^w[7]<<16,o[3]=w[6]^w[3]>>>16^w[1]<<16;for(var b=0;b<4;b++)o[b]=(o[b]<<8|o[b]>>>24)&16711935|(o[b]<<24|o[b]>>>8)&4278255360,u[y+b]^=o[b]},blockSize:128/32,ivSize:64/32});function g(){for(var u=this._X,y=this._C,w=0;w<8;w++)d[w]=y[w];y[0]=y[0]+1295307597+this._b|0,y[1]=y[1]+3545052371+(y[0]>>>0<d[0]>>>0?1:0)|0,y[2]=y[2]+886263092+(y[1]>>>0<d[1]>>>0?1:0)|0,y[3]=y[3]+1295307597+(y[2]>>>0<d[2]>>>0?1:0)|0,y[4]=y[4]+3545052371+(y[3]>>>0<d[3]>>>0?1:0)|0,y[5]=y[5]+886263092+(y[4]>>>0<d[4]>>>0?1:0)|0,y[6]=y[6]+1295307597+(y[5]>>>0<d[5]>>>0?1:0)|0,y[7]=y[7]+3545052371+(y[6]>>>0<d[6]>>>0?1:0)|0,this._b=y[7]>>>0<d[7]>>>0?1:0;for(var w=0;w<8;w++){var b=u[w]+y[w],C=b&65535,x=b>>>16,p=((C*C>>>17)+C*x>>>15)+x*x,E=((b&4294901760)*b|0)+((b&65535)*b|0);c[w]=p^E}u[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,u[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,u[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,u[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,u[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,u[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,u[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,u[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}s.Rabbit=n._createHelper(l)}(),t.Rabbit})}(Ri)),Ri.exports}var Fi={exports:{}},ya;function I0(){return ya||(ya=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),He())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.StreamCipher,a=s.algo,o=[],d=[],c=[],l=a.RabbitLegacy=n.extend({_doReset:function(){var u=this._key.words,y=this.cfg.iv,w=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],b=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var C=0;C<4;C++)g.call(this);for(var C=0;C<8;C++)b[C]^=w[C+4&7];if(y){var x=y.words,p=x[0],E=x[1],_=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,R=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,T=_>>>16|R&4294901760,F=R<<16|_&65535;b[0]^=_,b[1]^=T,b[2]^=R,b[3]^=F,b[4]^=_,b[5]^=T,b[6]^=R,b[7]^=F;for(var C=0;C<4;C++)g.call(this)}},_doProcessBlock:function(u,y){var w=this._X;g.call(this),o[0]=w[0]^w[5]>>>16^w[3]<<16,o[1]=w[2]^w[7]>>>16^w[5]<<16,o[2]=w[4]^w[1]>>>16^w[7]<<16,o[3]=w[6]^w[3]>>>16^w[1]<<16;for(var b=0;b<4;b++)o[b]=(o[b]<<8|o[b]>>>24)&16711935|(o[b]<<24|o[b]>>>8)&4278255360,u[y+b]^=o[b]},blockSize:128/32,ivSize:64/32});function g(){for(var u=this._X,y=this._C,w=0;w<8;w++)d[w]=y[w];y[0]=y[0]+1295307597+this._b|0,y[1]=y[1]+3545052371+(y[0]>>>0<d[0]>>>0?1:0)|0,y[2]=y[2]+886263092+(y[1]>>>0<d[1]>>>0?1:0)|0,y[3]=y[3]+1295307597+(y[2]>>>0<d[2]>>>0?1:0)|0,y[4]=y[4]+3545052371+(y[3]>>>0<d[3]>>>0?1:0)|0,y[5]=y[5]+886263092+(y[4]>>>0<d[4]>>>0?1:0)|0,y[6]=y[6]+1295307597+(y[5]>>>0<d[5]>>>0?1:0)|0,y[7]=y[7]+3545052371+(y[6]>>>0<d[6]>>>0?1:0)|0,this._b=y[7]>>>0<d[7]>>>0?1:0;for(var w=0;w<8;w++){var b=u[w]+y[w],C=b&65535,x=b>>>16,p=((C*C>>>17)+C*x>>>15)+x*x,E=((b&4294901760)*b|0)+((b&65535)*b|0);c[w]=p^E}u[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,u[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,u[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,u[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,u[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,u[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,u[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,u[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}s.RabbitLegacy=n._createHelper(l)}(),t.RabbitLegacy})}(Fi)),Fi.exports}var ki={exports:{}},wa;function P0(){return wa||(wa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),He())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.BlockCipher,a=s.algo;const o=16,d=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function g(C,x){let p=x>>24&255,E=x>>16&255,_=x>>8&255,R=x&255,T=C.sbox[0][p]+C.sbox[1][E];return T=T^C.sbox[2][_],T=T+C.sbox[3][R],T}function u(C,x,p){let E=x,_=p,R;for(let T=0;T<o;++T)E=E^C.pbox[T],_=g(C,E)^_,R=E,E=_,_=R;return R=E,E=_,_=R,_=_^C.pbox[o],E=E^C.pbox[o+1],{left:E,right:_}}function y(C,x,p){let E=x,_=p,R;for(let T=o+1;T>1;--T)E=E^C.pbox[T],_=g(C,E)^_,R=E,E=_,_=R;return R=E,E=_,_=R,_=_^C.pbox[1],E=E^C.pbox[0],{left:E,right:_}}function w(C,x,p){for(let F=0;F<4;F++){C.sbox[F]=[];for(let h=0;h<256;h++)C.sbox[F][h]=c[F][h]}let E=0;for(let F=0;F<o+2;F++)C.pbox[F]=d[F]^x[E],E++,E>=p&&(E=0);let _=0,R=0,T=0;for(let F=0;F<o+2;F+=2)T=u(C,_,R),_=T.left,R=T.right,C.pbox[F]=_,C.pbox[F+1]=R;for(let F=0;F<4;F++)for(let h=0;h<256;h+=2)T=u(C,_,R),_=T.left,R=T.right,C.sbox[F][h]=_,C.sbox[F][h+1]=R;return!0}var b=a.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var C=this._keyPriorReset=this._key,x=C.words,p=C.sigBytes/4;w(l,x,p)}},encryptBlock:function(C,x){var p=u(l,C[x],C[x+1]);C[x]=p.left,C[x+1]=p.right},decryptBlock:function(C,x){var p=y(l,C[x],C[x+1]);C[x]=p.left,C[x+1]=p.right},blockSize:64/32,keySize:128/32,ivSize:64/32});s.Blowfish=n._createHelper(b)}(),t.Blowfish})}(ki)),ki.exports}(function(r,e){(function(t,s,i){r.exports=s(ce(),os(),d0(),h0(),sr(),u0(),ir(),Gn(),ii(),f0(),Zn(),g0(),x0(),p0(),hi(),m0(),Wt(),He(),v0(),y0(),w0(),E0(),b0(),C0(),_0(),D0(),A0(),S0(),T0(),R0(),F0(),k0(),B0(),I0(),P0())})(ie,function(t){return t})})(Nn);var H0=Nn.exports;const nr=Yo(H0);let Q=null,Ae=null,mr=null;const qe={setConfig(r){Q=r},getConfig(){return Q},decrypt(r,e=null,t=null){var s,i;try{const n=e||((s=Q==null?void 0:Q.env)==null?void 0:s.DECODE_IV)||"default_iv_1234",a=t||((i=Q==null?void 0:Q.env)==null?void 0:i.DECODE_KEY)||"default_key_1234",o=nr.enc.Base64.parse(r),d=nr.enc.Utf8.parse(a),c=nr.enc.Utf8.parse(n);return nr.AES.decrypt({ciphertext:o},d,{iv:c,mode:nr.mode.CTR,padding:nr.pad.NoPadding}).toString(nr.enc.Utf8)}catch(n){return console.log("ERROR ===> failed decrypt:",n),!1}},pushSound(){try{mr&&clearInterval(mr);const r=()=>{try{(!Ae||Ae.state==="closed")&&(Ae=new(window.AudioContext||window.webkitAudioContext)),Ae.state==="suspended"&&Ae.resume();const e=Ae.createOscillator(),t=Ae.createOscillator(),s=Ae.createGain();e.type="sine",t.type="sine",e.frequency.setValueAtTime(400,Ae.currentTime),t.frequency.setValueAtTime(450,Ae.currentTime);const i=Ae.createOscillator(),n=Ae.createGain();i.frequency.value=25,n.gain.value=15,i.connect(n),n.connect(e.frequency),n.connect(t.frequency),e.connect(s),t.connect(s),s.connect(Ae.destination),s.gain.setValueAtTime(0,Ae.currentTime),s.gain.linearRampToValueAtTime(.08,Ae.currentTime+.05),s.gain.setValueAtTime(.08,Ae.currentTime+1.2),s.gain.linearRampToValueAtTime(0,Ae.currentTime+1.3),i.start(),e.start(),t.start(),i.stop(Ae.currentTime+1.4),e.stop(Ae.currentTime+1.4),t.stop(Ae.currentTime+1.4)}catch(e){console.warn("Failed to play synthesized tone:",e)}};r(),mr=setInterval(r,3e3)}catch(r){console.warn("AudioContext initialization failed:",r)}},stopSound(){mr&&(clearInterval(mr),mr=null),Ae&&(Ae.close().catch(()=>{}),Ae=null)},pushNotification(r){V.emitToParent("show_notification",{message:r})},toHHMMSS(r){const e=parseInt(r,10),t=Math.floor(e/3600),s=Math.floor(e/60)%60,i=e%60;return[t,s,i].map(n=>n<10?"0"+n:n).filter((n,a)=>n!=="00"||a>0).join(":")},mute(r,e,t,s){r?e?r.unmute():r.mute():s&&(e?s.unmuteAudio():s.muteAudio()),t(!e)},hold(r,e,t,s){r?e?r.unhold():r.hold():s&&(e?s.unhold():s.hold()),t(!e)},async hangup(r,e,t,s,i,n,a,o){s&&await s(!1),i&&i(!1),n&&n(0),r&&r.current&&clearInterval(r.current),e?(await(e==null?void 0:e.terminate("hangup")),a&&a(!1),V.emitLocal("yeastarSession",!1)):t&&(await(t==null?void 0:t.hangup()),o&&o(!1),V.emitLocal("flashphonerCall",!1))},attachRemoteAudio(r){if(!r)return;let e=document.getElementById("ys-remote-audio");e||(e=document.createElement("audio"),e.id="ys-remote-audio",e.autoplay=!0,e.playsInline=!0,e.hidden=!0,document.body.appendChild(e)),e.srcObject=r,e.play().catch(()=>{console.warn("User gesture needed to play audio"),V.emitLocal("needUserGestureToPlay",!0)})},getContactName(r){return r&&((Q==null?void 0:Q.contacts)||{1001:"John Doe",1002:"Jane Smith","08123456789":"Alice Johnson",123:"Customer Support"})[r]||null},async updateExtensionStatus(r,e="Ready",t="ready"){var s,i,n;try{const a=(Q==null?void 0:Q["X-CPAAS-Key-Fingerprint"])||(Q==null?void 0:Q.fingerprint)||(Q==null?void 0:Q.cpaasKeyFingerprint)||((s=Q==null?void 0:Q.env)==null?void 0:s.fingerprint)||((i=Q==null?void 0:Q.env)==null?void 0:i.X_CPAAS_Key_Fingerprint)||((n=Q==null?void 0:Q.pabxConfig)==null?void 0:n["X-CPAAS-Key-Fingerprint"]);if(!a)return console.warn("X-CPAAS-Key-Fingerprint not found. Cannot update extension status."),!1;const o=await fetch("https://api-cpaas.omnix.co.id/voice/extensions/status",{method:"POST",headers:{"X-CPAAS-Key-Fingerprint":a,"Content-Type":"application/json"},body:JSON.stringify({extension:r,status:e,reason:t})}),d=await o.json();return console.log(`[ExtStatus] ${e}/${t}:`,d),o.ok}catch(a){return console.error("Failed to update extension status:",a),!1}},async fetchExtensionStatus(r){var e,t,s,i;try{const n=(Q==null?void 0:Q["X-CPAAS-Key-Fingerprint"])||(Q==null?void 0:Q.fingerprint)||(Q==null?void 0:Q.cpaasKeyFingerprint)||((e=Q==null?void 0:Q.env)==null?void 0:e.fingerprint)||((t=Q==null?void 0:Q.env)==null?void 0:t.X_CPAAS_Key_Fingerprint)||((s=Q==null?void 0:Q.pabxConfig)==null?void 0:s["X-CPAAS-Key-Fingerprint"]);if(!n)return console.warn("X-CPAAS-Key-Fingerprint not found. Cannot fetch extension status."),null;const a=await fetch(`https://api-cpaas.omnix.co.id/voice/portal/extension?extension=${encodeURIComponent(r)}`,{method:"GET",headers:{"X-CPAAS-Key-Fingerprint":n,"Content-Type":"application/json"}});if(!a.ok)return null;const o=await a.json(),d=(i=o==null?void 0:o.data)==null?void 0:i[0];return console.log(`[ExtStatus] fetch ${r}:`,d),d||null}catch(n){return console.error("Failed to fetch extension status:",n),null}},getExtensionUsername(){var r,e;return((r=Q==null?void 0:Q.auth)==null?void 0:r.user_pbx)||((e=Q==null?void 0:Q.auth)==null?void 0:e.username)||null}};function $0({initialRegisterStatus:r="CONNECTING",autoReady:e=!0,showAuxButton:t=!1,auxOptions:s=[]}){const[i,n]=se.useState(""),[a,o]=se.useState("Idle"),[d,c]=se.useState("00:00"),[l,g]=se.useState(!1),[u,y]=se.useState(!1),[w,b]=se.useState(!1),[C,x]=se.useState(""),[p,E]=se.useState(""),[_,R]=se.useState(""),[T,F]=se.useState(r),[h,O]=se.useState(""),[A,f]=se.useState(e&&r==="REGISTERED"?"READY":"NOT_READY"),[v,m]=se.useState(!1),[U,j]=se.useState(null),X=se.useCallback(q=>{E(q),setTimeout(()=>E(""),4e3)},[]);se.useEffect(()=>{const q=[V.on("call_status",W=>{o(W),W!=="InCall"&&(b(!1),x(""),y(!1),g(!1))}),V.on("call_duration",c),V.on("incoming_call",W=>{var pt,Ye,Oe,lt,Xe,Tt,mt,vt;const Ee=((Ye=(pt=W==null?void 0:W.remoteIdentity)==null?void 0:pt.uri)==null?void 0:Ye.user)||(W==null?void 0:W.from_id)||"Unknown",ct=((Oe=W==null?void 0:W.remoteIdentity)==null?void 0:Oe.displayName)||((Xe=(lt=W==null?void 0:W.request)==null?void 0:lt.from)==null?void 0:Xe.displayName)||((vt=(mt=(Tt=W==null?void 0:W.incomingInviteRequest)==null?void 0:Tt.message)==null?void 0:mt.from)==null?void 0:vt.displayName)||(W==null?void 0:W.from_name)||qe.getContactName(Ee)||"";n(Ee),R(ct),o("Ringing")}),V.on("register_status",W=>{const Ee=typeof W=="string"?W:(W==null?void 0:W.status)??"FAILED",ct=typeof W=="object"?W==null?void 0:W.reason:"";F(Ee),O(Ee==="FAILED"?ct||"Failed to connect to Voice Platform":""),Ee!=="REGISTERED"&&Ee!=="SIP_CONNECTED"&&f("NOT_READY")}),V.on("agent_status",W=>{f(W),W!=="AUX"&&j(null)}),V.on("call_failed",W=>X(W||"Call Failed"))];return()=>q.forEach(W=>W())},[X]),se.useEffect(()=>{a==="Idle"&&R(qe.getContactName(i)||"")},[i,a]),se.useEffect(()=>{const q=W=>{W.metaKey||W.ctrlKey||W.altKey||(a==="InCall"&&/^[0-9*#]$/.test(W.key)?H(W.key):a==="Idle"&&T==="REGISTERED"&&/^[0-9+*#]$/.test(W.key)?n(Ee=>Ee+W.key):a==="Idle"&&W.key==="Backspace"?n(Ee=>Ee.slice(0,-1)):a==="Idle"&&W.key==="Enter"&&I())};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[a,T,i]);const G=async(q,W)=>{const Ee=qe.getExtensionUsername();if(!Ee)return!1;m(!0);const ct=await qe.updateExtensionStatus(Ee,q,W);return m(!1),ct},ne=async()=>{await G("Ready","ready")&&(f("READY"),j(null),V.emitLocal("register_status","REGISTERED"),V.emitLocal("agent_status","READY"))},he=async()=>{await G("Logout","not_ready")&&(f("NOT_READY"),j(null),V.emitLocal("register_status","SIP_CONNECTED"),V.emitLocal("agent_status","NOT_READY"))},ue=async(q=null)=>{const W=(q==null?void 0:q.code)||"AUX",Ee=(q==null?void 0:q.label)||"AUX";await G("AUX",W)&&(f("AUX"),j({code:W,label:Ee}),V.emitLocal("agent_status","AUX")),setShowAuxMenu(!1)},I=()=>{const q=i.trim();q&&V.emitLocal("local_dial",{number:q})},H=q=>{x(W=>W+q),V.emitLocal("local_dtmf",{key:q})},$=()=>V.emitLocal("local_hangup"),P=()=>V.emitLocal("local_answer"),we=()=>V.emitLocal("local_reject"),pe=()=>{const q=!l;g(q),V.emitLocal("local_toggle_mute",{muted:q})},ke=()=>{V.emitLocal("local_toggle_hold",{isOnHold:u,setIsOnHold:y})};if(a==="Ringing")return S.jsxs(vr,{error:p,children:[S.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[S.jsx(Bi,{color:"green",pulse:!0,children:S.jsx(Hn,{className:"w-9 h-9 text-green-600"})}),S.jsxs("div",{className:"text-center space-y-1",children:[S.jsx("p",{className:"text-lg font-bold text-gray-800 leading-tight",children:_||i||"Unknown"}),_&&S.jsx("p",{className:"text-sm font-mono text-gray-400 tracking-wider",children:i}),S.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-green-50 border border-green-100 mt-1",children:[S.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),S.jsx("span",{className:"text-[11px] font-semibold text-green-600 uppercase tracking-widest",children:"Incoming Call"})]})]})]}),S.jsxs(Ea,{children:[S.jsx(Ii,{color:"red",size:"lg",onClick:we,title:"Reject",children:S.jsx(as,{className:"w-6 h-6"})}),S.jsx(Ii,{color:"green",size:"lg",onClick:P,title:"Answer",pulse:!0,children:S.jsx(Or,{className:"w-6 h-6 fill-white"})})]})]});if(a==="Calling...")return S.jsxs(vr,{error:p,children:[S.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[S.jsx(Bi,{color:"primary",pulse:!0,children:S.jsx(s0,{className:"w-9 h-9 text-primary"})}),S.jsxs("div",{className:"text-center space-y-1",children:[S.jsx("p",{className:"text-lg font-bold text-gray-800 leading-tight",children:_||i}),_&&S.jsx("p",{className:"text-xs font-mono text-gray-400 tracking-wider",children:i}),S.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/8 border border-primary/15 mt-1",children:[S.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary animate-pulse"}),S.jsx("span",{className:"text-[11px] font-semibold text-primary uppercase tracking-widest",children:"Dialing..."})]})]})]}),S.jsx(Ea,{children:S.jsx(Ii,{color:"red",size:"lg",onClick:$,title:"Cancel",children:S.jsx(as,{className:"w-6 h-6"})})})]});if(a==="InCall")return S.jsxs(vr,{error:p,children:[w?S.jsxs("div",{className:"animate-fadeIn",children:[S.jsxs("div",{className:"px-6 pt-5 pb-2 text-center",children:[S.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-[0.2em] mb-2",children:"DTMF"}),S.jsx("div",{className:"min-h-[44px] flex items-center justify-center",children:S.jsx("span",{className:"text-3xl font-light text-gray-700 tracking-[0.25em] font-mono",children:C||S.jsx("span",{className:"text-gray-200",children:"—"})})})]}),S.jsx($n,{onKeyPress:H})]}):S.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[S.jsx(Bi,{color:u?"primary":"green",pulse:!u,children:u?S.jsx(Pn,{className:"w-9 h-9 text-primary"}):S.jsx(Hn,{className:"w-9 h-9 text-green-600"})}),S.jsxs("div",{className:"text-center space-y-1",children:[S.jsx("p",{className:"text-base font-bold text-gray-800 leading-tight",children:_||i||"Connected"}),_&&S.jsx("p",{className:"text-xs font-mono text-gray-400 tracking-wider",children:i}),S.jsxs("div",{className:"flex items-center justify-center gap-2 mt-1",children:[!u&&S.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),S.jsx("span",{className:`text-sm font-mono font-semibold ${u?"text-primary":"text-green-600"}`,children:u?"On Hold":d})]})]})]}),S.jsx("div",{className:"border-t border-gray-100 bg-gray-50/60 px-6 py-4",children:S.jsxs("div",{className:"flex items-center justify-between gap-2 max-w-[260px] mx-auto",children:[S.jsx(Pi,{onClick:pe,active:l,activeColor:"red",title:l?"Unmute":"Mute",children:l?S.jsx(t0,{className:"w-[18px] h-[18px]"}):S.jsx(r0,{className:"w-[18px] h-[18px]"})}),S.jsx(Pi,{onClick:ke,active:u,activeColor:"primary",title:u?"Resume":"Hold",children:u?S.jsx(i0,{className:"w-[18px] h-[18px]"}):S.jsx(Pn,{className:"w-[18px] h-[18px]"})}),S.jsx(Pi,{onClick:()=>b(q=>!q),active:w,activeColor:"primary",title:"Keypad",children:S.jsx(e0,{className:"w-[18px] h-[18px]"})}),S.jsx("button",{onClick:$,title:"End Call",className:"w-12 h-12 rounded-full bg-red-500 hover:bg-red-600 text-white flex items-center justify-center shadow-[0_4px_14px_rgba(239,68,68,0.4)] hover:shadow-[0_6px_18px_rgba(239,68,68,0.5)] transition-all active:scale-95",children:S.jsx(as,{className:"w-5 h-5"})})]})})]});if(T==="REGISTERED")return S.jsxs(vr,{error:p,children:[S.jsxs("div",{className:"px-5 pt-5 pb-1",children:[S.jsxs("div",{className:"relative flex items-center justify-center min-h-[56px] bg-gray-50 rounded-2xl border border-gray-100 px-10",children:[S.jsx("input",{type:"text",value:i,onChange:q=>n(q.target.value.replace(/[^0-9+*#]/g,"")),onKeyDown:q=>q.key==="Enter"&&I(),className:"w-full text-center text-[28px] font-light text-gray-800 tracking-[0.12em] bg-transparent outline-none placeholder:text-gray-300 placeholder:text-2xl placeholder:font-normal",placeholder:"Enter number"}),i&&S.jsx("button",{onClick:()=>n(q=>q.slice(0,-1)),onMouseDown:q=>q.preventDefault(),className:"absolute right-3 p-1.5 rounded-full text-gray-300 hover:text-gray-500 hover:bg-gray-200 transition-all",children:S.jsx(Qo,{className:"w-4 h-4"})})]}),_&&S.jsx("p",{className:"text-center text-xs text-primary/70 font-medium mt-1.5 tracking-wide",children:_})]}),S.jsx($n,{onKeyPress:q=>n(W=>W+q)}),S.jsx("div",{className:"px-5 pb-4 pt-1 flex justify-center",children:S.jsxs("button",{onClick:I,disabled:!i.trim(),className:`
|
|
143
|
+
*/return t.mode.CTRGladman=function(){var s=t.lib.BlockCipherMode.extend();function i(o){if((o>>24&255)===255){var d=o>>16&255,c=o>>8&255,l=o&255;d===255?(d=0,c===255?(c=0,l===255?l=0:++l):++c):++d,o=0,o+=d<<16,o+=c<<8,o+=l}else o+=1<<24;return o}function n(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var a=s.Encryptor=s.extend({processBlock:function(o,d){var c=this._cipher,l=c.blockSize,g=this._iv,f=this._counter;g&&(f=this._counter=g.slice(0),this._iv=void 0),n(f);var w=f.slice(0);c.encryptBlock(w,0);for(var y=0;y<l;y++)o[d+y]^=w[y]}});return s.Decryptor=a,s}(),t.mode.CTRGladman})}(mi)),mi.exports}var vi={exports:{}},oa;function E0(){return oa||(oa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.mode.OFB=function(){var s=t.lib.BlockCipherMode.extend(),i=s.Encryptor=s.extend({processBlock:function(n,a){var o=this._cipher,d=o.blockSize,c=this._iv,l=this._keystream;c&&(l=this._keystream=c.slice(0),this._iv=void 0),o.encryptBlock(l,0);for(var g=0;g<d;g++)n[a+g]^=l[g]}});return s.Decryptor=i,s}(),t.mode.OFB})}(vi)),vi.exports}var yi={exports:{}},ca;function b0(){return ca||(ca=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.mode.ECB=function(){var s=t.lib.BlockCipherMode.extend();return s.Encryptor=s.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),s.Decryptor=s.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),s}(),t.mode.ECB})}(yi)),yi.exports}var wi={exports:{}},la;function C0(){return la||(la=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.pad.AnsiX923={pad:function(s,i){var n=s.sigBytes,a=i*4,o=a-n%a,d=n+o-1;s.clamp(),s.words[d>>>2]|=o<<24-d%4*8,s.sigBytes+=o},unpad:function(s){var i=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=i}},t.pad.Ansix923})}(wi)),wi.exports}var Ei={exports:{}},da;function _0(){return da||(da=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.pad.Iso10126={pad:function(s,i){var n=i*4,a=n-s.sigBytes%n;s.concat(t.lib.WordArray.random(a-1)).concat(t.lib.WordArray.create([a<<24],1))},unpad:function(s){var i=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=i}},t.pad.Iso10126})}(Ei)),Ei.exports}var bi={exports:{}},ha;function D0(){return ha||(ha=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.pad.Iso97971={pad:function(s,i){s.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(s,i)},unpad:function(s){t.pad.ZeroPadding.unpad(s),s.sigBytes--}},t.pad.Iso97971})}(bi)),bi.exports}var Ci={exports:{}},ua;function A0(){return ua||(ua=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.pad.ZeroPadding={pad:function(s,i){var n=i*4;s.clamp(),s.sigBytes+=n-(s.sigBytes%n||n)},unpad:function(s){for(var i=s.words,n=s.sigBytes-1,n=s.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){s.sigBytes=n+1;break}}},t.pad.ZeroPadding})}(Ci)),Ci.exports}var _i={exports:{}},fa;function S0(){return fa||(fa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}(_i)),_i.exports}var Di={exports:{}},ga;function T0(){return ga||(ga=1,function(r,e){(function(t,s,i){r.exports=s(ce(),Pe())})(ie,function(t){return function(s){var i=t,n=i.lib,a=n.CipherParams,o=i.enc,d=o.Hex,c=i.format;c.Hex={stringify:function(l){return l.ciphertext.toString(d)},parse:function(l){var g=d.parse(l);return a.create({ciphertext:g})}}}(),t.format.Hex})}(Di)),Di.exports}var Ai={exports:{}},xa;function R0(){return xa||(xa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),Pe())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.BlockCipher,a=s.algo,o=[],d=[],c=[],l=[],g=[],f=[],w=[],y=[],b=[],C=[];(function(){for(var E=[],_=0;_<256;_++)_<128?E[_]=_<<1:E[_]=_<<1^283;for(var R=0,T=0,_=0;_<256;_++){var F=T^T<<1^T<<2^T<<3^T<<4;F=F>>>8^F&255^99,o[R]=F,d[F]=R;var h=E[R],O=E[h],A=E[O],u=E[F]*257^F*16843008;c[R]=u<<24|u>>>8,l[R]=u<<16|u>>>16,g[R]=u<<8|u>>>24,f[R]=u;var u=A*16843009^O*65537^h*257^R*16843008;w[F]=u<<24|u>>>8,y[F]=u<<16|u>>>16,b[F]=u<<8|u>>>24,C[F]=u,R?(R=h^E[E[E[A^h]]],T^=E[E[T]]):R=T=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],p=a.AES=n.extend({_doReset:function(){var E;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,R=_.words,T=_.sigBytes/4,F=this._nRounds=T+6,h=(F+1)*4,O=this._keySchedule=[],A=0;A<h;A++)A<T?O[A]=R[A]:(E=O[A-1],A%T?T>6&&A%T==4&&(E=o[E>>>24]<<24|o[E>>>16&255]<<16|o[E>>>8&255]<<8|o[E&255]):(E=E<<8|E>>>24,E=o[E>>>24]<<24|o[E>>>16&255]<<16|o[E>>>8&255]<<8|o[E&255],E^=x[A/T|0]<<24),O[A]=O[A-T]^E);for(var u=this._invKeySchedule=[],v=0;v<h;v++){var A=h-v;if(v%4)var E=O[A];else var E=O[A-4];v<4||A<=4?u[v]=E:u[v]=w[o[E>>>24]]^y[o[E>>>16&255]]^b[o[E>>>8&255]]^C[o[E&255]]}}},encryptBlock:function(E,_){this._doCryptBlock(E,_,this._keySchedule,c,l,g,f,o)},decryptBlock:function(E,_){var R=E[_+1];E[_+1]=E[_+3],E[_+3]=R,this._doCryptBlock(E,_,this._invKeySchedule,w,y,b,C,d);var R=E[_+1];E[_+1]=E[_+3],E[_+3]=R},_doCryptBlock:function(E,_,R,T,F,h,O,A){for(var u=this._nRounds,v=E[_]^R[0],m=E[_+1]^R[1],U=E[_+2]^R[2],j=E[_+3]^R[3],J=4,V=1;V<u;V++){var ne=T[v>>>24]^F[m>>>16&255]^h[U>>>8&255]^O[j&255]^R[J++],he=T[m>>>24]^F[U>>>16&255]^h[j>>>8&255]^O[v&255]^R[J++],ue=T[U>>>24]^F[j>>>16&255]^h[v>>>8&255]^O[m&255]^R[J++],I=T[j>>>24]^F[v>>>16&255]^h[m>>>8&255]^O[U&255]^R[J++];v=ne,m=he,U=ue,j=I}var ne=(A[v>>>24]<<24|A[m>>>16&255]<<16|A[U>>>8&255]<<8|A[j&255])^R[J++],he=(A[m>>>24]<<24|A[U>>>16&255]<<16|A[j>>>8&255]<<8|A[v&255])^R[J++],ue=(A[U>>>24]<<24|A[j>>>16&255]<<16|A[v>>>8&255]<<8|A[m&255])^R[J++],I=(A[j>>>24]<<24|A[v>>>16&255]<<16|A[m>>>8&255]<<8|A[U&255])^R[J++];E[_]=ne,E[_+1]=he,E[_+2]=ue,E[_+3]=I},keySize:256/32});s.AES=n._createHelper(p)}(),t.AES})}(Ai)),Ai.exports}var Si={exports:{}},pa;function F0(){return pa||(pa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),Pe())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.WordArray,a=i.BlockCipher,o=s.algo,d=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],g=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],w=o.DES=a.extend({_doReset:function(){for(var x=this._key,p=x.words,E=[],_=0;_<56;_++){var R=d[_]-1;E[_]=p[R>>>5]>>>31-R%32&1}for(var T=this._subKeys=[],F=0;F<16;F++){for(var h=T[F]=[],O=l[F],_=0;_<24;_++)h[_/6|0]|=E[(c[_]-1+O)%28]<<31-_%6,h[4+(_/6|0)]|=E[28+(c[_+24]-1+O)%28]<<31-_%6;h[0]=h[0]<<1|h[0]>>>31;for(var _=1;_<7;_++)h[_]=h[_]>>>(_-1)*4+3;h[7]=h[7]<<5|h[7]>>>27}for(var A=this._invSubKeys=[],_=0;_<16;_++)A[_]=T[15-_]},encryptBlock:function(x,p){this._doCryptBlock(x,p,this._subKeys)},decryptBlock:function(x,p){this._doCryptBlock(x,p,this._invSubKeys)},_doCryptBlock:function(x,p,E){this._lBlock=x[p],this._rBlock=x[p+1],y.call(this,4,252645135),y.call(this,16,65535),b.call(this,2,858993459),b.call(this,8,16711935),y.call(this,1,1431655765);for(var _=0;_<16;_++){for(var R=E[_],T=this._lBlock,F=this._rBlock,h=0,O=0;O<8;O++)h|=g[O][((F^R[O])&f[O])>>>0];this._lBlock=F,this._rBlock=T^h}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,y.call(this,1,1431655765),b.call(this,8,16711935),b.call(this,2,858993459),y.call(this,16,65535),y.call(this,4,252645135),x[p]=this._lBlock,x[p+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function y(x,p){var E=(this._lBlock>>>x^this._rBlock)&p;this._rBlock^=E,this._lBlock^=E<<x}function b(x,p){var E=(this._rBlock>>>x^this._lBlock)&p;this._lBlock^=E,this._rBlock^=E<<x}s.DES=a._createHelper(w);var C=o.TripleDES=a.extend({_doReset:function(){var x=this._key,p=x.words;if(p.length!==2&&p.length!==4&&p.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var E=p.slice(0,2),_=p.length<4?p.slice(0,2):p.slice(2,4),R=p.length<6?p.slice(0,2):p.slice(4,6);this._des1=w.createEncryptor(n.create(E)),this._des2=w.createEncryptor(n.create(_)),this._des3=w.createEncryptor(n.create(R))},encryptBlock:function(x,p){this._des1.encryptBlock(x,p),this._des2.decryptBlock(x,p),this._des3.encryptBlock(x,p)},decryptBlock:function(x,p){this._des3.decryptBlock(x,p),this._des2.encryptBlock(x,p),this._des1.decryptBlock(x,p)},keySize:192/32,ivSize:64/32,blockSize:64/32});s.TripleDES=a._createHelper(C)}(),t.TripleDES})}(Si)),Si.exports}var Ti={exports:{}},ma;function k0(){return ma||(ma=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),Pe())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.StreamCipher,a=s.algo,o=a.RC4=n.extend({_doReset:function(){for(var l=this._key,g=l.words,f=l.sigBytes,w=this._S=[],y=0;y<256;y++)w[y]=y;for(var y=0,b=0;y<256;y++){var C=y%f,x=g[C>>>2]>>>24-C%4*8&255;b=(b+w[y]+x)%256;var p=w[y];w[y]=w[b],w[b]=p}this._i=this._j=0},_doProcessBlock:function(l,g){l[g]^=d.call(this)},keySize:256/32,ivSize:0});function d(){for(var l=this._S,g=this._i,f=this._j,w=0,y=0;y<4;y++){g=(g+1)%256,f=(f+l[g])%256;var b=l[g];l[g]=l[f],l[f]=b,w|=l[(l[g]+l[f])%256]<<24-y*8}return this._i=g,this._j=f,w}s.RC4=n._createHelper(o);var c=a.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var l=this.cfg.drop;l>0;l--)d.call(this)}});s.RC4Drop=n._createHelper(c)}(),t.RC4})}(Ti)),Ti.exports}var Ri={exports:{}},va;function B0(){return va||(va=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),Pe())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.StreamCipher,a=s.algo,o=[],d=[],c=[],l=a.Rabbit=n.extend({_doReset:function(){for(var f=this._key.words,w=this.cfg.iv,y=0;y<4;y++)f[y]=(f[y]<<8|f[y]>>>24)&16711935|(f[y]<<24|f[y]>>>8)&4278255360;var b=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],C=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var y=0;y<4;y++)g.call(this);for(var y=0;y<8;y++)C[y]^=b[y+4&7];if(w){var x=w.words,p=x[0],E=x[1],_=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,R=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,T=_>>>16|R&4294901760,F=R<<16|_&65535;C[0]^=_,C[1]^=T,C[2]^=R,C[3]^=F,C[4]^=_,C[5]^=T,C[6]^=R,C[7]^=F;for(var y=0;y<4;y++)g.call(this)}},_doProcessBlock:function(f,w){var y=this._X;g.call(this),o[0]=y[0]^y[5]>>>16^y[3]<<16,o[1]=y[2]^y[7]>>>16^y[5]<<16,o[2]=y[4]^y[1]>>>16^y[7]<<16,o[3]=y[6]^y[3]>>>16^y[1]<<16;for(var b=0;b<4;b++)o[b]=(o[b]<<8|o[b]>>>24)&16711935|(o[b]<<24|o[b]>>>8)&4278255360,f[w+b]^=o[b]},blockSize:128/32,ivSize:64/32});function g(){for(var f=this._X,w=this._C,y=0;y<8;y++)d[y]=w[y];w[0]=w[0]+1295307597+this._b|0,w[1]=w[1]+3545052371+(w[0]>>>0<d[0]>>>0?1:0)|0,w[2]=w[2]+886263092+(w[1]>>>0<d[1]>>>0?1:0)|0,w[3]=w[3]+1295307597+(w[2]>>>0<d[2]>>>0?1:0)|0,w[4]=w[4]+3545052371+(w[3]>>>0<d[3]>>>0?1:0)|0,w[5]=w[5]+886263092+(w[4]>>>0<d[4]>>>0?1:0)|0,w[6]=w[6]+1295307597+(w[5]>>>0<d[5]>>>0?1:0)|0,w[7]=w[7]+3545052371+(w[6]>>>0<d[6]>>>0?1:0)|0,this._b=w[7]>>>0<d[7]>>>0?1:0;for(var y=0;y<8;y++){var b=f[y]+w[y],C=b&65535,x=b>>>16,p=((C*C>>>17)+C*x>>>15)+x*x,E=((b&4294901760)*b|0)+((b&65535)*b|0);c[y]=p^E}f[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,f[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,f[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,f[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,f[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,f[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,f[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,f[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}s.Rabbit=n._createHelper(l)}(),t.Rabbit})}(Ri)),Ri.exports}var Fi={exports:{}},ya;function I0(){return ya||(ya=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),Pe())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.StreamCipher,a=s.algo,o=[],d=[],c=[],l=a.RabbitLegacy=n.extend({_doReset:function(){var f=this._key.words,w=this.cfg.iv,y=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],b=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var C=0;C<4;C++)g.call(this);for(var C=0;C<8;C++)b[C]^=y[C+4&7];if(w){var x=w.words,p=x[0],E=x[1],_=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,R=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,T=_>>>16|R&4294901760,F=R<<16|_&65535;b[0]^=_,b[1]^=T,b[2]^=R,b[3]^=F,b[4]^=_,b[5]^=T,b[6]^=R,b[7]^=F;for(var C=0;C<4;C++)g.call(this)}},_doProcessBlock:function(f,w){var y=this._X;g.call(this),o[0]=y[0]^y[5]>>>16^y[3]<<16,o[1]=y[2]^y[7]>>>16^y[5]<<16,o[2]=y[4]^y[1]>>>16^y[7]<<16,o[3]=y[6]^y[3]>>>16^y[1]<<16;for(var b=0;b<4;b++)o[b]=(o[b]<<8|o[b]>>>24)&16711935|(o[b]<<24|o[b]>>>8)&4278255360,f[w+b]^=o[b]},blockSize:128/32,ivSize:64/32});function g(){for(var f=this._X,w=this._C,y=0;y<8;y++)d[y]=w[y];w[0]=w[0]+1295307597+this._b|0,w[1]=w[1]+3545052371+(w[0]>>>0<d[0]>>>0?1:0)|0,w[2]=w[2]+886263092+(w[1]>>>0<d[1]>>>0?1:0)|0,w[3]=w[3]+1295307597+(w[2]>>>0<d[2]>>>0?1:0)|0,w[4]=w[4]+3545052371+(w[3]>>>0<d[3]>>>0?1:0)|0,w[5]=w[5]+886263092+(w[4]>>>0<d[4]>>>0?1:0)|0,w[6]=w[6]+1295307597+(w[5]>>>0<d[5]>>>0?1:0)|0,w[7]=w[7]+3545052371+(w[6]>>>0<d[6]>>>0?1:0)|0,this._b=w[7]>>>0<d[7]>>>0?1:0;for(var y=0;y<8;y++){var b=f[y]+w[y],C=b&65535,x=b>>>16,p=((C*C>>>17)+C*x>>>15)+x*x,E=((b&4294901760)*b|0)+((b&65535)*b|0);c[y]=p^E}f[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,f[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,f[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,f[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,f[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,f[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,f[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,f[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}s.RabbitLegacy=n._createHelper(l)}(),t.RabbitLegacy})}(Fi)),Fi.exports}var ki={exports:{}},wa;function H0(){return wa||(wa=1,function(r,e){(function(t,s,i){r.exports=s(ce(),sr(),ir(),Wt(),Pe())})(ie,function(t){return function(){var s=t,i=s.lib,n=i.BlockCipher,a=s.algo;const o=16,d=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function g(C,x){let p=x>>24&255,E=x>>16&255,_=x>>8&255,R=x&255,T=C.sbox[0][p]+C.sbox[1][E];return T=T^C.sbox[2][_],T=T+C.sbox[3][R],T}function f(C,x,p){let E=x,_=p,R;for(let T=0;T<o;++T)E=E^C.pbox[T],_=g(C,E)^_,R=E,E=_,_=R;return R=E,E=_,_=R,_=_^C.pbox[o],E=E^C.pbox[o+1],{left:E,right:_}}function w(C,x,p){let E=x,_=p,R;for(let T=o+1;T>1;--T)E=E^C.pbox[T],_=g(C,E)^_,R=E,E=_,_=R;return R=E,E=_,_=R,_=_^C.pbox[1],E=E^C.pbox[0],{left:E,right:_}}function y(C,x,p){for(let F=0;F<4;F++){C.sbox[F]=[];for(let h=0;h<256;h++)C.sbox[F][h]=c[F][h]}let E=0;for(let F=0;F<o+2;F++)C.pbox[F]=d[F]^x[E],E++,E>=p&&(E=0);let _=0,R=0,T=0;for(let F=0;F<o+2;F+=2)T=f(C,_,R),_=T.left,R=T.right,C.pbox[F]=_,C.pbox[F+1]=R;for(let F=0;F<4;F++)for(let h=0;h<256;h+=2)T=f(C,_,R),_=T.left,R=T.right,C.sbox[F][h]=_,C.sbox[F][h+1]=R;return!0}var b=a.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var C=this._keyPriorReset=this._key,x=C.words,p=C.sigBytes/4;y(l,x,p)}},encryptBlock:function(C,x){var p=f(l,C[x],C[x+1]);C[x]=p.left,C[x+1]=p.right},decryptBlock:function(C,x){var p=w(l,C[x],C[x+1]);C[x]=p.left,C[x+1]=p.right},blockSize:64/32,keySize:128/32,ivSize:64/32});s.Blowfish=n._createHelper(b)}(),t.Blowfish})}(ki)),ki.exports}(function(r,e){(function(t,s,i){r.exports=s(ce(),os(),d0(),h0(),sr(),u0(),ir(),Gn(),ii(),f0(),Zn(),g0(),x0(),p0(),hi(),m0(),Wt(),Pe(),v0(),y0(),w0(),E0(),b0(),C0(),_0(),D0(),A0(),S0(),T0(),R0(),F0(),k0(),B0(),I0(),H0())})(ie,function(t){return t})})(Nn);var P0=Nn.exports;const nr=Yo(P0);let L=null,Ae=null,mr=null;const $e={setConfig(r){L=r},getConfig(){return L},decrypt(r,e=null,t=null){var s,i;try{const n=e||((s=L==null?void 0:L.env)==null?void 0:s.DECODE_IV)||"default_iv_1234",a=t||((i=L==null?void 0:L.env)==null?void 0:i.DECODE_KEY)||"default_key_1234",o=nr.enc.Base64.parse(r),d=nr.enc.Utf8.parse(a),c=nr.enc.Utf8.parse(n);return nr.AES.decrypt({ciphertext:o},d,{iv:c,mode:nr.mode.CTR,padding:nr.pad.NoPadding}).toString(nr.enc.Utf8)}catch(n){return console.log("ERROR ===> failed decrypt:",n),!1}},pushSound(){try{mr&&clearInterval(mr);const r=()=>{try{(!Ae||Ae.state==="closed")&&(Ae=new(window.AudioContext||window.webkitAudioContext)),Ae.state==="suspended"&&Ae.resume();const e=Ae.createOscillator(),t=Ae.createOscillator(),s=Ae.createGain();e.type="sine",t.type="sine",e.frequency.setValueAtTime(400,Ae.currentTime),t.frequency.setValueAtTime(450,Ae.currentTime);const i=Ae.createOscillator(),n=Ae.createGain();i.frequency.value=25,n.gain.value=15,i.connect(n),n.connect(e.frequency),n.connect(t.frequency),e.connect(s),t.connect(s),s.connect(Ae.destination),s.gain.setValueAtTime(0,Ae.currentTime),s.gain.linearRampToValueAtTime(.08,Ae.currentTime+.05),s.gain.setValueAtTime(.08,Ae.currentTime+1.2),s.gain.linearRampToValueAtTime(0,Ae.currentTime+1.3),i.start(),e.start(),t.start(),i.stop(Ae.currentTime+1.4),e.stop(Ae.currentTime+1.4),t.stop(Ae.currentTime+1.4)}catch(e){console.warn("Failed to play synthesized tone:",e)}};r(),mr=setInterval(r,3e3)}catch(r){console.warn("AudioContext initialization failed:",r)}},stopSound(){mr&&(clearInterval(mr),mr=null),Ae&&(Ae.close().catch(()=>{}),Ae=null)},pushNotification(r){z.emitToParent("show_notification",{message:r})},toHHMMSS(r){const e=parseInt(r,10),t=Math.floor(e/3600),s=Math.floor(e/60)%60,i=e%60;return[t,s,i].map(n=>n<10?"0"+n:n).filter((n,a)=>n!=="00"||a>0).join(":")},mute(r,e,t,s){r?e?r.unmute():r.mute():s&&(e?s.unmuteAudio():s.muteAudio()),t(!e)},hold(r,e,t,s){r?e?r.unhold():r.hold():s&&(e?s.unhold():s.hold()),t(!e)},async hangup(r,e,t,s,i,n,a,o){s&&await s(!1),i&&i(!1),n&&n(0),r&&r.current&&clearInterval(r.current),e?(await(e==null?void 0:e.terminate("hangup")),a&&a(!1),z.emitLocal("yeastarSession",!1)):t&&(await(t==null?void 0:t.hangup()),o&&o(!1),z.emitLocal("flashphonerCall",!1))},attachRemoteAudio(r){if(!r)return;let e=document.getElementById("ys-remote-audio");e||(e=document.createElement("audio"),e.id="ys-remote-audio",e.autoplay=!0,e.playsInline=!0,e.hidden=!0,document.body.appendChild(e)),e.srcObject=r,e.play().catch(()=>{console.warn("User gesture needed to play audio"),z.emitLocal("needUserGestureToPlay",!0)})},getContactName(r){return r&&((L==null?void 0:L.contacts)||{1001:"John Doe",1002:"Jane Smith","08123456789":"Alice Johnson",123:"Customer Support"})[r]||null},getCpaasBaseUrl(){var r,e;return(L==null?void 0:L.cpaas_base_url)||(L==null?void 0:L.cpaasBaseUrl)||((r=L==null?void 0:L.env)==null?void 0:r.CPAAS_BASE_URL)||((e=L==null?void 0:L.pabxConfig)==null?void 0:e.cpaas_base_url)||"https://api-cpaas.omnix.co.id"},getSipHost(){var e,t,s;const r=i=>{var n;return((n=i==null?void 0:i.replace("https://",""))==null?void 0:n.replace("http://",""))||null};return r(L==null?void 0:L.pbx_url)||r((e=L==null?void 0:L.pabxConfig)==null?void 0:e.pbx_url)||r((t=L==null?void 0:L.auth)==null?void 0:t.pabx_host)||((s=L==null?void 0:L.auth)==null?void 0:s.pbxurl)||null},getWssHost(){var e;const r=t=>{var s;return((s=t==null?void 0:t.replace(/^wss?:\/\//,""))==null?void 0:s.replace(/\/$/,""))||null};return r(L==null?void 0:L.sip_url)||r((e=L==null?void 0:L.pabxConfig)==null?void 0:e.sip_url)||this.getSipHost()},async updateExtensionStatus(r,e="Ready",t="ready"){var s,i,n;try{const a=(L==null?void 0:L["X-CPAAS-Key-Fingerprint"])||(L==null?void 0:L.fingerprint)||(L==null?void 0:L.cpaasKeyFingerprint)||((s=L==null?void 0:L.env)==null?void 0:s.fingerprint)||((i=L==null?void 0:L.env)==null?void 0:i.X_CPAAS_Key_Fingerprint)||((n=L==null?void 0:L.pabxConfig)==null?void 0:n["X-CPAAS-Key-Fingerprint"]);if(!a)return console.warn("X-CPAAS-Key-Fingerprint not found. Cannot update extension status."),!1;const o=this.getCpaasBaseUrl(),d=await fetch(`${o}/voice/extensions/status`,{method:"POST",headers:{"X-CPAAS-Key-Fingerprint":a,"Content-Type":"application/json"},body:JSON.stringify({extension:r,status:e,reason:t})}),c=await d.json();return console.log(`[ExtStatus] ${e}/${t}:`,c),d.ok}catch(a){return console.error("Failed to update extension status:",a),!1}},async fetchExtensionStatus(r){var e,t,s,i;try{const n=(L==null?void 0:L["X-CPAAS-Key-Fingerprint"])||(L==null?void 0:L.fingerprint)||(L==null?void 0:L.cpaasKeyFingerprint)||((e=L==null?void 0:L.env)==null?void 0:e.fingerprint)||((t=L==null?void 0:L.env)==null?void 0:t.X_CPAAS_Key_Fingerprint)||((s=L==null?void 0:L.pabxConfig)==null?void 0:s["X-CPAAS-Key-Fingerprint"]);if(!n)return console.warn("X-CPAAS-Key-Fingerprint not found. Cannot fetch extension status."),null;const a=this.getCpaasBaseUrl(),o=await fetch(`${a}/voice/portal/extension?extension=${encodeURIComponent(r)}`,{method:"GET",headers:{"X-CPAAS-Key-Fingerprint":n,"Content-Type":"application/json"}});if(!o.ok)return null;const d=await o.json(),c=(i=d==null?void 0:d.data)==null?void 0:i[0];return console.log(`[ExtStatus] fetch ${r}:`,c),c||null}catch(n){return console.error("Failed to fetch extension status:",n),null}},getExtensionUsername(){var r,e;return((r=L==null?void 0:L.auth)==null?void 0:r.user_pbx)||((e=L==null?void 0:L.auth)==null?void 0:e.username)||null}};function $0({initialRegisterStatus:r="CONNECTING",autoReady:e=!0,showAuxButton:t=!1,auxOptions:s=[]}){const[i,n]=se.useState(""),[a,o]=se.useState("Idle"),[d,c]=se.useState("00:00"),[l,g]=se.useState(!1),[f,w]=se.useState(!1),[y,b]=se.useState(!1),[C,x]=se.useState(""),[p,E]=se.useState(""),[_,R]=se.useState(""),[T,F]=se.useState(r),[h,O]=se.useState(""),[A,u]=se.useState(e&&r==="REGISTERED"?"READY":"NOT_READY"),[v,m]=se.useState(!1),[U,j]=se.useState(null),J=se.useCallback(q=>{E(q),setTimeout(()=>E(""),4e3)},[]);se.useEffect(()=>{const q=[z.on("call_status",G=>{o(G),G!=="InCall"&&(b(!1),x(""),w(!1),g(!1))}),z.on("call_duration",c),z.on("incoming_call",G=>{var pt,Ye,Me,lt,Xe,Tt,mt,vt;const Ee=((Ye=(pt=G==null?void 0:G.remoteIdentity)==null?void 0:pt.uri)==null?void 0:Ye.user)||(G==null?void 0:G.from_id)||"Unknown",ct=((Me=G==null?void 0:G.remoteIdentity)==null?void 0:Me.displayName)||((Xe=(lt=G==null?void 0:G.request)==null?void 0:lt.from)==null?void 0:Xe.displayName)||((vt=(mt=(Tt=G==null?void 0:G.incomingInviteRequest)==null?void 0:Tt.message)==null?void 0:mt.from)==null?void 0:vt.displayName)||(G==null?void 0:G.from_name)||$e.getContactName(Ee)||"";n(Ee),R(ct),o("Ringing")}),z.on("register_status",G=>{const Ee=typeof G=="string"?G:(G==null?void 0:G.status)??"FAILED",ct=typeof G=="object"?G==null?void 0:G.reason:"";F(Ee),O(Ee==="FAILED"?ct||"Failed to connect to Voice Platform":""),Ee!=="REGISTERED"&&Ee!=="SIP_CONNECTED"&&u("NOT_READY")}),z.on("agent_status",G=>{u(G),G!=="AUX"&&j(null)}),z.on("call_failed",G=>J(G||"Call Failed"))];return()=>q.forEach(G=>G())},[J]),se.useEffect(()=>{a==="Idle"&&R($e.getContactName(i)||"")},[i,a]),se.useEffect(()=>{const q=G=>{G.metaKey||G.ctrlKey||G.altKey||(a==="InCall"&&/^[0-9*#]$/.test(G.key)?P(G.key):a==="Idle"&&T==="REGISTERED"&&/^[0-9+*#]$/.test(G.key)?n(Ee=>Ee+G.key):a==="Idle"&&G.key==="Backspace"?n(Ee=>Ee.slice(0,-1)):a==="Idle"&&G.key==="Enter"&&I())};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[a,T,i]);const V=async(q,G)=>{const Ee=$e.getExtensionUsername();if(!Ee)return!1;m(!0);const ct=await $e.updateExtensionStatus(Ee,q,G);return m(!1),ct},ne=async()=>{await V("Ready","ready")&&(u("READY"),j(null),z.emitLocal("register_status","REGISTERED"),z.emitLocal("agent_status","READY"))},he=async()=>{await V("Logout","not_ready")&&(u("NOT_READY"),j(null),z.emitLocal("register_status","SIP_CONNECTED"),z.emitLocal("agent_status","NOT_READY"))},ue=async(q=null)=>{const G=(q==null?void 0:q.code)||"AUX",Ee=(q==null?void 0:q.label)||"AUX";await V("AUX",G)&&(u("AUX"),j({code:G,label:Ee}),z.emitLocal("agent_status","AUX")),setShowAuxMenu(!1)},I=()=>{const q=i.trim();q&&z.emitLocal("local_dial",{number:q})},P=q=>{x(G=>G+q),z.emitLocal("local_dtmf",{key:q})},$=()=>z.emitLocal("local_hangup"),H=()=>z.emitLocal("local_answer"),we=()=>z.emitLocal("local_reject"),pe=()=>{const q=!l;g(q),z.emitLocal("local_toggle_mute",{muted:q})},ke=()=>{z.emitLocal("local_toggle_hold",{isOnHold:f,setIsOnHold:w})};if(a==="Ringing")return S.jsxs(vr,{error:p,children:[S.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[S.jsx(Bi,{color:"green",pulse:!0,children:S.jsx(Pn,{className:"w-9 h-9 text-green-600"})}),S.jsxs("div",{className:"text-center space-y-1",children:[S.jsx("p",{className:"text-lg font-bold text-gray-800 leading-tight",children:_||i||"Unknown"}),_&&S.jsx("p",{className:"text-sm font-mono text-gray-400 tracking-wider",children:i}),S.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-green-50 border border-green-100 mt-1",children:[S.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),S.jsx("span",{className:"text-[11px] font-semibold text-green-600 uppercase tracking-widest",children:"Incoming Call"})]})]})]}),S.jsxs(Ea,{children:[S.jsx(Ii,{color:"red",size:"lg",onClick:we,title:"Reject",children:S.jsx(as,{className:"w-6 h-6"})}),S.jsx(Ii,{color:"green",size:"lg",onClick:H,title:"Answer",pulse:!0,children:S.jsx(Or,{className:"w-6 h-6 fill-white"})})]})]});if(a==="Calling...")return S.jsxs(vr,{error:p,children:[S.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[S.jsx(Bi,{color:"primary",pulse:!0,children:S.jsx(s0,{className:"w-9 h-9 text-primary"})}),S.jsxs("div",{className:"text-center space-y-1",children:[S.jsx("p",{className:"text-lg font-bold text-gray-800 leading-tight",children:_||i}),_&&S.jsx("p",{className:"text-xs font-mono text-gray-400 tracking-wider",children:i}),S.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/8 border border-primary/15 mt-1",children:[S.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary animate-pulse"}),S.jsx("span",{className:"text-[11px] font-semibold text-primary uppercase tracking-widest",children:"Dialing..."})]})]})]}),S.jsx(Ea,{children:S.jsx(Ii,{color:"red",size:"lg",onClick:$,title:"Cancel",children:S.jsx(as,{className:"w-6 h-6"})})})]});if(a==="InCall")return S.jsxs(vr,{error:p,children:[y?S.jsxs("div",{className:"animate-fadeIn",children:[S.jsxs("div",{className:"px-6 pt-5 pb-2 text-center",children:[S.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-[0.2em] mb-2",children:"DTMF"}),S.jsx("div",{className:"min-h-[44px] flex items-center justify-center",children:S.jsx("span",{className:"text-3xl font-light text-gray-700 tracking-[0.25em] font-mono",children:C||S.jsx("span",{className:"text-gray-200",children:"—"})})})]}),S.jsx($n,{onKeyPress:P})]}):S.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[S.jsx(Bi,{color:f?"primary":"green",pulse:!f,children:f?S.jsx(Hn,{className:"w-9 h-9 text-primary"}):S.jsx(Pn,{className:"w-9 h-9 text-green-600"})}),S.jsxs("div",{className:"text-center space-y-1",children:[S.jsx("p",{className:"text-base font-bold text-gray-800 leading-tight",children:_||i||"Connected"}),_&&S.jsx("p",{className:"text-xs font-mono text-gray-400 tracking-wider",children:i}),S.jsxs("div",{className:"flex items-center justify-center gap-2 mt-1",children:[!f&&S.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),S.jsx("span",{className:`text-sm font-mono font-semibold ${f?"text-primary":"text-green-600"}`,children:f?"On Hold":d})]})]})]}),S.jsx("div",{className:"border-t border-gray-100 bg-gray-50/60 px-6 py-4",children:S.jsxs("div",{className:"flex items-center justify-between gap-2 max-w-[260px] mx-auto",children:[S.jsx(Hi,{onClick:pe,active:l,activeColor:"red",title:l?"Unmute":"Mute",children:l?S.jsx(t0,{className:"w-[18px] h-[18px]"}):S.jsx(r0,{className:"w-[18px] h-[18px]"})}),S.jsx(Hi,{onClick:ke,active:f,activeColor:"primary",title:f?"Resume":"Hold",children:f?S.jsx(i0,{className:"w-[18px] h-[18px]"}):S.jsx(Hn,{className:"w-[18px] h-[18px]"})}),S.jsx(Hi,{onClick:()=>b(q=>!q),active:y,activeColor:"primary",title:"Keypad",children:S.jsx(e0,{className:"w-[18px] h-[18px]"})}),S.jsx("button",{onClick:$,title:"End Call",className:"w-12 h-12 rounded-full bg-red-500 hover:bg-red-600 text-white flex items-center justify-center shadow-[0_4px_14px_rgba(239,68,68,0.4)] hover:shadow-[0_6px_18px_rgba(239,68,68,0.5)] transition-all active:scale-95",children:S.jsx(as,{className:"w-5 h-5"})})]})})]});if(T==="REGISTERED")return S.jsxs(vr,{error:p,children:[S.jsxs("div",{className:"px-5 pt-5 pb-1",children:[S.jsxs("div",{className:"relative flex items-center justify-center min-h-[56px] bg-gray-50 rounded-2xl border border-gray-100 px-10",children:[S.jsx("input",{type:"text",value:i,onChange:q=>n(q.target.value.replace(/[^0-9+*#]/g,"")),onKeyDown:q=>q.key==="Enter"&&I(),className:"w-full text-center text-[28px] font-light text-gray-800 tracking-[0.12em] bg-transparent outline-none placeholder:text-gray-300 placeholder:text-2xl placeholder:font-normal",placeholder:"Enter number"}),i&&S.jsx("button",{onClick:()=>n(q=>q.slice(0,-1)),onMouseDown:q=>q.preventDefault(),className:"absolute right-3 p-1.5 rounded-full text-gray-300 hover:text-gray-500 hover:bg-gray-200 transition-all",children:S.jsx(Qo,{className:"w-4 h-4"})})]}),_&&S.jsx("p",{className:"text-center text-xs text-primary/70 font-medium mt-1.5 tracking-wide",children:_})]}),S.jsx($n,{onKeyPress:q=>n(G=>G+q)}),S.jsx("div",{className:"px-5 pb-4 pt-1 flex justify-center",children:S.jsxs("button",{onClick:I,disabled:!i.trim(),className:`
|
|
144
144
|
flex items-center gap-3 px-10 py-3.5 rounded-full
|
|
145
145
|
bg-gradient-to-r from-green-500 to-green-600
|
|
146
146
|
hover:from-green-600 hover:to-green-700
|
|
@@ -150,18 +150,18 @@ React keys must be passed directly to JSX without using spread:
|
|
|
150
150
|
hover:shadow-[0_6px_20px_rgba(34,197,94,0.5)]
|
|
151
151
|
disabled:shadow-none
|
|
152
152
|
transition-all active:scale-95
|
|
153
|
-
`,children:[S.jsx(Or,{className:"w-4 h-4 fill-white"}),"Call"]})}),S.jsx(N0,{agentStatus:A,currentAux:U,loading:v,autoReady:e,showAuxButton:t,auxOptions:s,onReady:ne,onNotReady:he,onAux:ue})]});if(T==="SIP_CONNECTED"){const q={READY:{label:"Ready",dot:"bg-green-500",text:"text-green-600"},NOT_READY:{label:"Not Ready",dot:"bg-gray-400",text:"text-gray-500"},AUX:{label:(U==null?void 0:U.label)||"AUX",dot:"bg-amber-400",text:"text-amber-600"}},W=q[A]||q.NOT_READY;return S.jsx(vr,{error:p,children:S.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-6 min-h-[300px] animate-fadeIn",children:[S.jsxs("div",{className:"relative w-16 h-16",children:[S.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-primary/20"}),S.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-transparent border-t-primary animate-spin",style:{animationDuration:"2.4s"}}),S.jsx("div",{className:"absolute inset-2 rounded-full bg-primary/10 flex items-center justify-center",children:S.jsx(Or,{className:"w-5 h-5 text-primary",style:{transform:"rotate(90deg)"}})})]}),S.jsxs("div",{className:"text-center space-y-2",children:[S.jsx("p",{className:"text-sm font-semibold text-gray-700",children:"SIP Connected"}),S.jsx("p",{className:"text-xs text-gray-400",children:"Click Ready to activate your session"}),S.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-gray-50 border border-gray-200 mt-1",children:[S.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${W.dot}`}),S.jsx("span",{className:`text-[11px] font-semibold ${W.text} uppercase tracking-wider`,children:W.label})]})]}),S.jsx("button",{onClick:ne,disabled:v,className:"flex items-center gap-2 px-6 py-2.5 rounded-full bg-primary text-white text-sm font-semibold shadow-md shadow-primary/30 hover:bg-primary-hover transition-all active:scale-95 disabled:opacity-60 disabled:cursor-not-allowed",children:v?S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-white/30 border-t-white animate-spin"}),"Setting Ready..."]}):S.jsxs(S.Fragment,{children:[S.jsx(Bn,{className:"w-4 h-4"}),"Set Ready"]})})]})})}return S.jsx(vr,{error:p,children:S.jsx("div",{className:"flex flex-col items-center justify-center px-6 py-12 gap-4 min-h-[280px] animate-fadeIn",children:T==="CONNECTING"?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"relative w-16 h-16",children:[S.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-primary/20"}),S.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-transparent border-t-primary animate-spin"}),S.jsx("div",{className:"absolute inset-2 rounded-full bg-primary/10 flex items-center justify-center",children:S.jsx(Or,{className:"w-5 h-5 text-primary",style:{transform:"rotate(90deg)"}})})]}),S.jsxs("div",{className:"text-center space-y-1",children:[S.jsx("p",{className:"text-sm font-semibold text-gray-700",children:"Connecting to server"}),S.jsx("p",{className:"text-xs text-gray-400",children:"Please wait..."})]})]}):S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"w-16 h-16 rounded-full bg-red-50 border-2 border-red-100 flex items-center justify-center",children:S.jsx(as,{className:"w-7 h-7 text-red-400"})}),S.jsxs("div",{className:"text-center space-y-1.5",children:[S.jsx("p",{className:"text-sm font-bold text-red-600",children:"Not Registered"}),h&&S.jsx("p",{className:"text-xs text-gray-400 max-w-[220px] leading-relaxed",children:h})]})]})})})}function vr({children:r,error:e}){return S.jsxs("div",{className:"w-full relative select-none",children:[e&&S.jsxs("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 px-4 py-2 rounded-full bg-red-500 text-white text-xs font-semibold shadow-lg animate-slideUp whitespace-nowrap",children:[S.jsx(Zo,{className:"w-3.5 h-3.5 shrink-0"}),e]}),r]})}function Ea({children:r}){return S.jsx("div",{className:"border-t border-gray-100 bg-gray-50/60 px-6 py-5 flex items-center justify-center gap-10 animate-slideUp",children:r})}function Bi({children:r,color:e="green",pulse:t=!1}){const s={green:{ring:"bg-green-500/15",ring2:"bg-green-500/8",wrap:"bg-green-50 border-green-200"},primary:{ring:"bg-primary/15",ring2:"bg-primary/8",wrap:"bg-primary/10 border-primary/20"},red:{ring:"bg-red-500/15",ring2:"bg-red-500/8",wrap:"bg-red-50 border-red-200"}},i=s[e]||s.green;return S.jsxs("div",{className:"relative flex items-center justify-center w-20 h-20",children:[t&&S.jsxs(S.Fragment,{children:[S.jsx("span",{className:`absolute w-20 h-20 rounded-full ${i.ring} animate-ping opacity-75`}),S.jsx("span",{className:`absolute w-28 h-28 rounded-full ${i.ring2} animate-pulse`})]}),S.jsx("div",{className:`relative z-10 w-16 h-16 rounded-full ${i.wrap} border-2 flex items-center justify-center shadow-sm`,children:r})]})}function Ii({children:r,onClick:e,color:t="gray",size:s="md",title:i,pulse:n=!1}){const a={md:"w-12 h-12",lg:"w-14 h-14"},o={green:"bg-green-500 hover:bg-green-600 shadow-[0_4px_14px_rgba(34,197,94,0.4)] hover:shadow-[0_6px_20px_rgba(34,197,94,0.5)]",red:"bg-red-500 hover:bg-red-600 shadow-[0_4px_14px_rgba(239,68,68,0.4)] hover:shadow-[0_6px_20px_rgba(239,68,68,0.5)]",gray:"bg-white border border-gray-200 text-gray-600 hover:bg-gray-50 shadow-sm"};return S.jsx("button",{onClick:e,title:i,className:`${a[s]} rounded-full text-white flex items-center justify-center transition-all active:scale-95 ${o[t]} ${n?"animate-pulse":""}`,children:r})}const ba={READY:{dot:"bg-green-500",label:"Ready",text:"text-green-700",bg:"bg-green-50 border-green-200"},NOT_READY:{dot:"bg-gray-400",label:"Not Ready",text:"text-gray-600",bg:"bg-gray-50 border-gray-200"},AUX:{dot:"bg-amber-400",label:"AUX",text:"text-amber-700",bg:"bg-amber-50 border-amber-200"}};function N0({agentStatus:r,currentAux:e,loading:t,autoReady:s,showAuxButton:i,auxOptions:n,onReady:a,onNotReady:o,onAux:d}){const[c,l]=se.useState(!1),g=se.useRef(null);se.useEffect(()=>{const p=E=>{g.current&&!g.current.contains(E.target)&&l(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const u=ba[r]||ba.NOT_READY,y=r==="AUX"&&e?`AUX: ${e.label}`:u.label,w=!s||i,b=()=>{l(!1),a()},C=()=>{l(!1),o()},x=p=>{l(!1),d(p)};return S.jsx("div",{className:"border-t border-gray-100 bg-gray-50/70 px-4 py-3",children:S.jsxs("div",{className:"flex items-center justify-between gap-2",children:[S.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-semibold ${u.bg} ${u.text}`,children:[S.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u.dot}`}),y]}),w&&S.jsxs("div",{className:"relative",ref:g,children:[S.jsxs("button",{onClick:()=>!t&&l(p=>!p),disabled:t,className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg text-[11px] font-semibold bg-white border border-gray-200 text-gray-600 hover:bg-gray-50 transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",children:[t?S.jsx("span",{className:"w-3 h-3 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"}):S.jsx(Jo,{className:`w-3 h-3 transition-transform duration-150 ${c?"":"rotate-180"}`}),"Status"]}),c&&S.jsxs("div",{className:"absolute bottom-full mb-1.5 right-0 w-48 bg-white rounded-xl shadow-xl border border-gray-100 overflow-hidden z-50 animate-slideUp",children:[!s&&S.jsxs(S.Fragment,{children:[S.jsxs("button",{onClick:b,disabled:r==="READY",className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left text-xs font-medium text-gray-700 hover:bg-green-50 hover:text-green-800 transition-colors disabled:opacity-40 disabled:cursor-not-allowed border-b border-gray-50",children:[S.jsx(Bn,{className:"w-3.5 h-3.5 text-green-500 shrink-0"}),"Ready",r==="READY"&&S.jsx("span",{className:"ml-auto text-[10px] text-green-500 font-semibold",children:"✓ Active"})]}),S.jsxs("button",{onClick:C,disabled:r==="NOT_READY",className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left text-xs font-medium text-gray-700 hover:bg-gray-100 transition-colors disabled:opacity-40 disabled:cursor-not-allowed border-b border-gray-50",children:[S.jsx(n0,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),"Not Ready",r==="NOT_READY"&&S.jsx("span",{className:"ml-auto text-[10px] text-gray-400 font-semibold",children:"✓ Active"})]})]}),!s&&i&&n.length>0&&S.jsxs("div",{className:"px-3.5 py-1.5 flex items-center gap-2",children:[S.jsx("div",{className:"flex-1 h-px bg-gray-100"}),S.jsx("span",{className:"text-[10px] text-gray-400 font-semibold uppercase tracking-wider",children:"AUX"}),S.jsx("div",{className:"flex-1 h-px bg-gray-100"})]}),i&&n.map(p=>S.jsxs("button",{onClick:()=>x(p),disabled:r==="AUX"&&(e==null?void 0:e.code)===p.code,className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left text-xs font-medium text-gray-700 hover:bg-amber-50 hover:text-amber-800 transition-colors border-b border-gray-50 last:border-0 disabled:opacity-40 disabled:cursor-not-allowed",children:[S.jsx(In,{className:"w-3.5 h-3.5 text-amber-500 shrink-0"}),p.label,r==="AUX"&&(e==null?void 0:e.code)===p.code&&S.jsx("span",{className:"ml-auto text-[10px] text-amber-500 font-semibold",children:"✓ Active"})]},p.code)),i&&n.length===0&&S.jsxs("button",{onClick:()=>x(null),disabled:r==="AUX",className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left text-xs font-medium text-gray-700 hover:bg-amber-50 hover:text-amber-800 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[S.jsx(In,{className:"w-3.5 h-3.5 text-amber-500 shrink-0"}),"AUX",r==="AUX"&&S.jsx("span",{className:"ml-auto text-[10px] text-amber-500 font-semibold",children:"✓ Active"})]})]})]})]})})}function Pi({children:r,onClick:e,active:t,activeColor:s="primary",title:i}){const n={red:"bg-red-500 border-red-500 text-white shadow-[0_2px_8px_rgba(239,68,68,0.35)]",primary:"bg-primary border-primary text-white shadow-[0_2px_8px_rgba(63,49,146,0.35)]"};return S.jsx("button",{onClick:e,title:i,className:`
|
|
153
|
+
`,children:[S.jsx(Or,{className:"w-4 h-4 fill-white"}),"Call"]})}),S.jsx(N0,{agentStatus:A,currentAux:U,loading:v,autoReady:e,showAuxButton:t,auxOptions:s,onReady:ne,onNotReady:he,onAux:ue})]});if(T==="SIP_CONNECTED"){const q={READY:{label:"Ready",dot:"bg-green-500",text:"text-green-600"},NOT_READY:{label:"Not Ready",dot:"bg-gray-400",text:"text-gray-500"},AUX:{label:(U==null?void 0:U.label)||"AUX",dot:"bg-amber-400",text:"text-amber-600"}},G=q[A]||q.NOT_READY;return S.jsx(vr,{error:p,children:S.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-6 min-h-[300px] animate-fadeIn",children:[S.jsxs("div",{className:"relative w-16 h-16",children:[S.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-primary/20"}),S.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-transparent border-t-primary animate-spin",style:{animationDuration:"2.4s"}}),S.jsx("div",{className:"absolute inset-2 rounded-full bg-primary/10 flex items-center justify-center",children:S.jsx(Or,{className:"w-5 h-5 text-primary",style:{transform:"rotate(90deg)"}})})]}),S.jsxs("div",{className:"text-center space-y-2",children:[S.jsx("p",{className:"text-sm font-semibold text-gray-700",children:"SIP Connected"}),S.jsx("p",{className:"text-xs text-gray-400",children:"Click Ready to activate your session"}),S.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-gray-50 border border-gray-200 mt-1",children:[S.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${G.dot}`}),S.jsx("span",{className:`text-[11px] font-semibold ${G.text} uppercase tracking-wider`,children:G.label})]})]}),S.jsx("button",{onClick:ne,disabled:v,className:"flex items-center gap-2 px-6 py-2.5 rounded-full bg-primary text-white text-sm font-semibold shadow-md shadow-primary/30 hover:bg-primary-hover transition-all active:scale-95 disabled:opacity-60 disabled:cursor-not-allowed",children:v?S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-white/30 border-t-white animate-spin"}),"Setting Ready..."]}):S.jsxs(S.Fragment,{children:[S.jsx(Bn,{className:"w-4 h-4"}),"Set Ready"]})})]})})}return S.jsx(vr,{error:p,children:S.jsx("div",{className:"flex flex-col items-center justify-center px-6 py-12 gap-4 min-h-[280px] animate-fadeIn",children:T==="CONNECTING"?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"relative w-16 h-16",children:[S.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-primary/20"}),S.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-transparent border-t-primary animate-spin"}),S.jsx("div",{className:"absolute inset-2 rounded-full bg-primary/10 flex items-center justify-center",children:S.jsx(Or,{className:"w-5 h-5 text-primary",style:{transform:"rotate(90deg)"}})})]}),S.jsxs("div",{className:"text-center space-y-1",children:[S.jsx("p",{className:"text-sm font-semibold text-gray-700",children:"Connecting to server"}),S.jsx("p",{className:"text-xs text-gray-400",children:"Please wait..."})]})]}):S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"w-16 h-16 rounded-full bg-red-50 border-2 border-red-100 flex items-center justify-center",children:S.jsx(as,{className:"w-7 h-7 text-red-400"})}),S.jsxs("div",{className:"text-center space-y-1.5",children:[S.jsx("p",{className:"text-sm font-bold text-red-600",children:"Not Registered"}),h&&S.jsx("p",{className:"text-xs text-gray-400 max-w-[220px] leading-relaxed",children:h})]})]})})})}function vr({children:r,error:e}){return S.jsxs("div",{className:"w-full relative select-none",children:[e&&S.jsxs("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 px-4 py-2 rounded-full bg-red-500 text-white text-xs font-semibold shadow-lg animate-slideUp whitespace-nowrap",children:[S.jsx(Zo,{className:"w-3.5 h-3.5 shrink-0"}),e]}),r]})}function Ea({children:r}){return S.jsx("div",{className:"border-t border-gray-100 bg-gray-50/60 px-6 py-5 flex items-center justify-center gap-10 animate-slideUp",children:r})}function Bi({children:r,color:e="green",pulse:t=!1}){const s={green:{ring:"bg-green-500/15",ring2:"bg-green-500/8",wrap:"bg-green-50 border-green-200"},primary:{ring:"bg-primary/15",ring2:"bg-primary/8",wrap:"bg-primary/10 border-primary/20"},red:{ring:"bg-red-500/15",ring2:"bg-red-500/8",wrap:"bg-red-50 border-red-200"}},i=s[e]||s.green;return S.jsxs("div",{className:"relative flex items-center justify-center w-20 h-20",children:[t&&S.jsxs(S.Fragment,{children:[S.jsx("span",{className:`absolute w-20 h-20 rounded-full ${i.ring} animate-ping opacity-75`}),S.jsx("span",{className:`absolute w-28 h-28 rounded-full ${i.ring2} animate-pulse`})]}),S.jsx("div",{className:`relative z-10 w-16 h-16 rounded-full ${i.wrap} border-2 flex items-center justify-center shadow-sm`,children:r})]})}function Ii({children:r,onClick:e,color:t="gray",size:s="md",title:i,pulse:n=!1}){const a={md:"w-12 h-12",lg:"w-14 h-14"},o={green:"bg-green-500 hover:bg-green-600 shadow-[0_4px_14px_rgba(34,197,94,0.4)] hover:shadow-[0_6px_20px_rgba(34,197,94,0.5)]",red:"bg-red-500 hover:bg-red-600 shadow-[0_4px_14px_rgba(239,68,68,0.4)] hover:shadow-[0_6px_20px_rgba(239,68,68,0.5)]",gray:"bg-white border border-gray-200 text-gray-600 hover:bg-gray-50 shadow-sm"};return S.jsx("button",{onClick:e,title:i,className:`${a[s]} rounded-full text-white flex items-center justify-center transition-all active:scale-95 ${o[t]} ${n?"animate-pulse":""}`,children:r})}const ba={READY:{dot:"bg-green-500",label:"Ready",text:"text-green-700",bg:"bg-green-50 border-green-200"},NOT_READY:{dot:"bg-gray-400",label:"Not Ready",text:"text-gray-600",bg:"bg-gray-50 border-gray-200"},AUX:{dot:"bg-amber-400",label:"AUX",text:"text-amber-700",bg:"bg-amber-50 border-amber-200"}};function N0({agentStatus:r,currentAux:e,loading:t,autoReady:s,showAuxButton:i,auxOptions:n,onReady:a,onNotReady:o,onAux:d}){const[c,l]=se.useState(!1),g=se.useRef(null);se.useEffect(()=>{const p=E=>{g.current&&!g.current.contains(E.target)&&l(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const f=ba[r]||ba.NOT_READY,w=r==="AUX"&&e?`AUX: ${e.label}`:f.label,y=!s||i,b=()=>{l(!1),a()},C=()=>{l(!1),o()},x=p=>{l(!1),d(p)};return S.jsx("div",{className:"border-t border-gray-100 bg-gray-50/70 px-4 py-3",children:S.jsxs("div",{className:"flex items-center justify-between gap-2",children:[S.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-semibold ${f.bg} ${f.text}`,children:[S.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${f.dot}`}),w]}),y&&S.jsxs("div",{className:"relative",ref:g,children:[S.jsxs("button",{onClick:()=>!t&&l(p=>!p),disabled:t,className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg text-[11px] font-semibold bg-white border border-gray-200 text-gray-600 hover:bg-gray-50 transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",children:[t?S.jsx("span",{className:"w-3 h-3 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"}):S.jsx(Jo,{className:`w-3 h-3 transition-transform duration-150 ${c?"":"rotate-180"}`}),"Status"]}),c&&S.jsxs("div",{className:"absolute bottom-full mb-1.5 right-0 w-48 bg-white rounded-xl shadow-xl border border-gray-100 overflow-hidden z-50 animate-slideUp",children:[!s&&S.jsxs(S.Fragment,{children:[S.jsxs("button",{onClick:b,disabled:r==="READY",className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left text-xs font-medium text-gray-700 hover:bg-green-50 hover:text-green-800 transition-colors disabled:opacity-40 disabled:cursor-not-allowed border-b border-gray-50",children:[S.jsx(Bn,{className:"w-3.5 h-3.5 text-green-500 shrink-0"}),"Ready",r==="READY"&&S.jsx("span",{className:"ml-auto text-[10px] text-green-500 font-semibold",children:"✓ Active"})]}),S.jsxs("button",{onClick:C,disabled:r==="NOT_READY",className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left text-xs font-medium text-gray-700 hover:bg-gray-100 transition-colors disabled:opacity-40 disabled:cursor-not-allowed border-b border-gray-50",children:[S.jsx(n0,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),"Not Ready",r==="NOT_READY"&&S.jsx("span",{className:"ml-auto text-[10px] text-gray-400 font-semibold",children:"✓ Active"})]})]}),!s&&i&&n.length>0&&S.jsxs("div",{className:"px-3.5 py-1.5 flex items-center gap-2",children:[S.jsx("div",{className:"flex-1 h-px bg-gray-100"}),S.jsx("span",{className:"text-[10px] text-gray-400 font-semibold uppercase tracking-wider",children:"AUX"}),S.jsx("div",{className:"flex-1 h-px bg-gray-100"})]}),i&&n.map(p=>S.jsxs("button",{onClick:()=>x(p),disabled:r==="AUX"&&(e==null?void 0:e.code)===p.code,className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left text-xs font-medium text-gray-700 hover:bg-amber-50 hover:text-amber-800 transition-colors border-b border-gray-50 last:border-0 disabled:opacity-40 disabled:cursor-not-allowed",children:[S.jsx(In,{className:"w-3.5 h-3.5 text-amber-500 shrink-0"}),p.label,r==="AUX"&&(e==null?void 0:e.code)===p.code&&S.jsx("span",{className:"ml-auto text-[10px] text-amber-500 font-semibold",children:"✓ Active"})]},p.code)),i&&n.length===0&&S.jsxs("button",{onClick:()=>x(null),disabled:r==="AUX",className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left text-xs font-medium text-gray-700 hover:bg-amber-50 hover:text-amber-800 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[S.jsx(In,{className:"w-3.5 h-3.5 text-amber-500 shrink-0"}),"AUX",r==="AUX"&&S.jsx("span",{className:"ml-auto text-[10px] text-amber-500 font-semibold",children:"✓ Active"})]})]})]})]})})}function Hi({children:r,onClick:e,active:t,activeColor:s="primary",title:i}){const n={red:"bg-red-500 border-red-500 text-white shadow-[0_2px_8px_rgba(239,68,68,0.35)]",primary:"bg-primary border-primary text-white shadow-[0_2px_8px_rgba(63,49,146,0.35)]"};return S.jsx("button",{onClick:e,title:i,className:`
|
|
154
154
|
w-11 h-11 rounded-full flex items-center justify-center
|
|
155
155
|
border transition-all active:scale-95
|
|
156
156
|
${t?n[s]:"bg-white border-gray-200 text-gray-500 hover:bg-gray-100 hover:text-gray-700"}
|
|
157
|
-
`,children:r})}const O0="0.21.1";class ar extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class
|
|
157
|
+
`,children:r})}const O0="0.21.1";class ar extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class Pi extends ar{constructor(e){super(e||"Unsupported content type.")}}class $i extends ar{constructor(e){super(e||"Request pending.")}}class M0 extends ar{constructor(e){super(e||"Unspecified session description handler error.")}}class Ni extends ar{constructor(){super("The session has terminated.")}}class Mr extends ar{constructor(e){super(e||"An error occurred during state transition.")}}class j0{constructor(e){this.incomingAckRequest=e}get request(){return this.incomingAckRequest.message}}class q0{constructor(e){this.incomingByeRequest=e}get request(){return this.incomingByeRequest.message}accept(e){return this.incomingByeRequest.accept(e),Promise.resolve()}reject(e){return this.incomingByeRequest.reject(e),Promise.resolve()}}class U0{constructor(e){this.incomingCancelRequest=e}get request(){return this.incomingCancelRequest}}class jr{constructor(){this.listeners=new Array}addListener(e,t){const s=i=>{this.removeListener(s),e(i)};(t==null?void 0:t.once)===!0?this.listeners.push(s):this.listeners.push(e)}emit(e){this.listeners.slice().forEach(t=>t(e))}removeAllListeners(){this.listeners=[]}removeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}on(e){return this.addListener(e)}off(e){return this.removeListener(e)}once(e){return this.addListener(e,{once:!0})}}class L0{constructor(e){this.incomingInfoRequest=e}get request(){return this.incomingInfoRequest.message}accept(e){return this.incomingInfoRequest.accept(e),Promise.resolve()}reject(e){return this.incomingInfoRequest.reject(e),Promise.resolve()}}class Ca{constructor(e){this.parameters={};for(const t in e)e.hasOwnProperty(t)&&this.setParam(t,e[t])}setParam(e,t){e&&(this.parameters[e.toLowerCase()]=typeof t>"u"||t===null?null:t.toString())}getParam(e){if(e)return this.parameters[e.toLowerCase()]}hasParam(e){return!!(e&&this.parameters[e.toLowerCase()]!==void 0)}deleteParam(e){if(e=e.toLowerCase(),this.hasParam(e)){const t=this.parameters[e];return delete this.parameters[e],t}}clearParams(){this.parameters={}}}class ze extends Ca{constructor(e,t,s){super(s),this.uri=e,this._displayName=t}get friendlyName(){return this.displayName||this.uri.aor}get displayName(){return this._displayName}set displayName(e){this._displayName=e}clone(){return new ze(this.uri.clone(),this._displayName,JSON.parse(JSON.stringify(this.parameters)))}toString(){let e=this.displayName||this.displayName==="0"?'"'+this.displayName+'" ':"";e+="<"+this.uri.toString()+">";for(const t in this.parameters)this.parameters.hasOwnProperty(t)&&(e+=";"+t,this.parameters[t]!==null&&(e+="="+this.parameters[t]));return e}}class yt extends Ca{constructor(e="sip",t,s,i,n,a){if(super(n||{}),this.headers={},!s)throw new TypeError('missing or invalid "host" parameter');for(const o in a)a.hasOwnProperty(o)&&this.setHeader(o,a[o]);this.raw={scheme:e,user:t,host:s,port:i},this.normal={scheme:e.toLowerCase(),user:t,host:s.toLowerCase(),port:i}}get scheme(){return this.normal.scheme}set scheme(e){this.raw.scheme=e,this.normal.scheme=e.toLowerCase()}get user(){return this.normal.user}set user(e){this.normal.user=this.raw.user=e}get host(){return this.normal.host}set host(e){this.raw.host=e,this.normal.host=e.toLowerCase()}get aor(){return this.normal.user+"@"+this.normal.host}get port(){return this.normal.port}set port(e){this.normal.port=this.raw.port=e}setHeader(e,t){this.headers[this.headerize(e)]=t instanceof Array?t:[t]}getHeader(e){if(e)return this.headers[this.headerize(e)]}hasHeader(e){return!!e&&!!this.headers.hasOwnProperty(this.headerize(e))}deleteHeader(e){if(e=this.headerize(e),this.headers.hasOwnProperty(e)){const t=this.headers[e];return delete this.headers[e],t}}clearHeaders(){this.headers={}}clone(){return new yt(this._raw.scheme,this._raw.user||"",this._raw.host,this._raw.port,JSON.parse(JSON.stringify(this.parameters)),JSON.parse(JSON.stringify(this.headers)))}toRaw(){return this._toString(this._raw)}toString(){return this._toString(this._normal)}get _normal(){return this.normal}get _raw(){return this.raw}_toString(e){let t=e.scheme+":";e.scheme.toLowerCase().match("^sips?$")||(t+="//"),e.user&&(t+=this.escapeUser(e.user)+"@"),t+=e.host,(e.port||e.port===0)&&(t+=":"+e.port);for(const i in this.parameters)this.parameters.hasOwnProperty(i)&&(t+=";"+i,this.parameters[i]!==null&&(t+="="+this.parameters[i]));const s=[];for(const i in this.headers)if(this.headers.hasOwnProperty(i))for(const n in this.headers[i])this.headers[i].hasOwnProperty(n)&&s.push(i+"="+this.headers[i][n]);return s.length>0&&(t+="?"+s.join("&")),t}escapeUser(e){let t;try{t=decodeURIComponent(e)}catch(s){throw s}return encodeURIComponent(t).replace(/%3A/ig,":").replace(/%2B/ig,"+").replace(/%3F/ig,"?").replace(/%2F/ig,"/")}headerize(e){const t={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},s=e.toLowerCase().replace(/_/g,"-").split("-"),i=s.length;let n="";for(let a=0;a<i;a++)a!==0&&(n+="-"),n+=s[a].charAt(0).toUpperCase()+s[a].substring(1);return t[n]&&(n=t[n]),n}}function _a(r,e){if(r.scheme!==e.scheme||r.user!==e.user||r.host!==e.host||r.port!==e.port)return!1;function t(n,a){const o=Object.keys(n.parameters),d=Object.keys(a.parameters);return!(!o.filter(l=>d.includes(l)).every(l=>n.parameters[l]===a.parameters[l])||!["user","ttl","method","transport"].every(l=>n.hasParam(l)&&a.hasParam(l)||!n.hasParam(l)&&!a.hasParam(l))||!["maddr"].every(l=>n.hasParam(l)&&a.hasParam(l)||!n.hasParam(l)&&!a.hasParam(l)))}if(!t(r,e))return!1;const s=Object.keys(r.headers),i=Object.keys(e.headers);if(s.length!==0||i.length!==0){if(s.length!==i.length)return!1;const n=s.filter(a=>i.includes(a));if(n.length!==i.length||!n.every(a=>r.headers[a].length&&e.headers[a].length&&r.headers[a][0]===e.headers[a][0]))return!1}return!0}function Oi(r,e,t){return t=t||" ",r.length>e?r:(e-=r.length,t+=t.repeat(e),r+t.slice(0,e))}class yr extends Error{constructor(e,t,s,i){super(),this.message=e,this.expected=t,this.found=s,this.location=i,this.name="SyntaxError",typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(this,yr.prototype):this.__proto__=yr.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,yr)}static buildMessage(e,t){function s(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,l=>"\\x0"+s(l)).replace(/[\x10-\x1F\x7F-\x9F]/g,l=>"\\x"+s(l))}function n(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,l=>"\\x0"+s(l)).replace(/[\x10-\x1F\x7F-\x9F]/g,l=>"\\x"+s(l))}function a(c){switch(c.type){case"literal":return'"'+i(c.text)+'"';case"class":const l=c.parts.map(g=>Array.isArray(g)?n(g[0])+"-"+n(g[1]):n(g));return"["+(c.inverted?"^":"")+l+"]";case"any":return"any character";case"end":return"end of input";case"other":return c.description}}function o(c){const l=c.map(a);let g,f;if(l.sort(),l.length>0){for(g=1,f=1;g<l.length;g++)l[g-1]!==l[g]&&(l[f]=l[g],f++);l.length=f}switch(l.length){case 1:return l[0];case 2:return l[0]+" or "+l[1];default:return l.slice(0,-1).join(", ")+", or "+l[l.length-1]}}function d(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+o(e)+" but "+d(t)+" found."}format(e){let t="Error: "+this.message;if(this.location){let s=null,i;for(i=0;i<e.length;i++)if(e[i].source===this.location.source){s=e[i].text.split(/\r\n|\n|\r/g);break}let n=this.location.start,a=this.location.source+":"+n.line+":"+n.column;if(s){let o=this.location.end,d=Oi("",n.line.toString().length," "),c=s[n.line-1],l=n.line===o.line?o.column:c.length+1;t+=`
|
|
158
158
|
--> `+a+`
|
|
159
159
|
`+d+` |
|
|
160
160
|
`+n.line+" | "+c+`
|
|
161
161
|
`+d+" | "+Oi("",n.column-1," ")+Oi("",l-n.column,"^")}else t+=`
|
|
162
162
|
at `+a}return t}}function Y0(r,e){e=e!==void 0?e:{};const t={},s=e.grammarSource,i={Contact:119,Name_Addr_Header:156,Record_Route:176,Request_Response:81,SIP_URI:45,Subscription_State:186,Supported:191,Require:182,Via:194,absoluteURI:84,Call_ID:118,Content_Disposition:130,Content_Length:135,Content_Type:136,CSeq:146,displayName:122,Event:149,From:151,host:52,Max_Forwards:154,Min_SE:213,Proxy_Authenticate:157,quoted_string:40,Refer_To:178,Replaces:179,Session_Expires:210,stun_URI:217,To:192,turn_URI:223,uuid:226,WWW_Authenticate:209,challenge:158,sipfrag:230,Referred_By:231};let n=119;const a=[`\r
|
|
163
163
|
`,x(`\r
|
|
164
|
-
`,!1),/^[0-9]/,p([["0","9"]],!1,!1),/^[a-zA-Z]/,p([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,p([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,p([["\0","ÿ"]],!1,!1),/^["]/,p(['"'],!1,!1)," ",x(" ",!1)," ",x(" ",!1),/^[a-zA-Z0-9]/,p([["a","z"],["A","Z"],["0","9"]],!1,!1),";",x(";",!1),"/",x("/",!1),"?",x("?",!1),":",x(":",!1),"@",x("@",!1),"&",x("&",!1),"=",x("=",!1),"+",x("+",!1),"$",x("$",!1),",",x(",",!1),"-",x("-",!1),"_",x("_",!1),".",x(".",!1),"!",x("!",!1),"~",x("~",!1),"*",x("*",!1),"'",x("'",!1),"(",x("(",!1),")",x(")",!1),"%",x("%",!1),function(){return" "},function(){return":"},/^[!-~]/,p([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,p([["",""]],!1,!1),/^[\x80-\xBF]/,p([["","¿"]],!1,!1),/^[a-f]/,p([["a","f"]],!1,!1),"`",x("`",!1),"<",x("<",!1),">",x(">",!1),"\\",x("\\",!1),"[",x("[",!1),"]",x("]",!1),"{",x("{",!1),"}",x("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,p([["!","'"]],!1,!1),/^[*-[]/,p([["*","["]],!1,!1),/^[\]-~]/,p([["]","~"]],!1,!1),function(f){return f},/^[#-[]/,p([["#","["]],!1,!1),/^[\0-\t]/,p([["\0"," "]],!1,!1),/^[\v-\f]/,p([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,p([["",""]],!1,!1),function(){e=e||{data:{}},e.data.uri=new yt(e.data.scheme,e.data.user,e.data.host,e.data.port),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port},function(){e=e||{data:{}},e.data.uri=new yt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params,e.startRule==="SIP_URI"&&(e.data=e.data.uri)},"sips",x("sips",!0),"sip",x("sip",!0),function(f){e=e||{data:{}},e.data.scheme=f},function(){e=e||{data:{}},e.data.user=decodeURIComponent(b().slice(0,-1))},function(){e=e||{data:{}},e.data.password=b()},function(){return e=e||{data:{}},e.data.host=b(),e.data.host},function(){return e=e||{data:{}},e.data.host_type="domain",b()},/^[a-zA-Z0-9_\-]/,p([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,p([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",b()},"::",x("::",!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",b()},function(){return e=e||{data:{}},e.data.host_type="IPv4",b()},"25",x("25",!1),/^[0-5]/,p([["0","5"]],!1,!1),"2",x("2",!1),/^[0-4]/,p([["0","4"]],!1,!1),"1",x("1",!1),/^[1-9]/,p([["1","9"]],!1,!1),function(f){return e=e||{data:{}},f=parseInt(f.join("")),e.data.port=f,f},"transport=",x("transport=",!0),"udp",x("udp",!0),"tcp",x("tcp",!0),"sctp",x("sctp",!0),"tls",x("tls",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.transport=f.toLowerCase()},"user=",x("user=",!0),"phone",x("phone",!0),"ip",x("ip",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.user=f.toLowerCase()},"method=",x("method=",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.method=f},"ttl=",x("ttl=",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.ttl=f},"maddr=",x("maddr=",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.maddr=f},"lr",x("lr",!0),function(){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.lr=void 0},function(f,v){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),v===null?v=void 0:v=v[1],e.data.uri_params[f.toLowerCase()]=v},function(f,v){f=f.join("").toLowerCase(),v=v.join(""),e=e||{data:{}},e.data.uri_headers||(e.data.uri_headers={}),e.data.uri_headers[f]?e.data.uri_headers[f].push(v):e.data.uri_headers[f]=[v]},function(){e=e||{data:{}},e.startRule==="Refer_To"&&(e.data.uri=new yt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params)},"//",x("//",!1),function(){e=e||{data:{}},e.data.scheme=b()},x("SIP",!0),function(){e=e||{data:{}},e.data.sip_version=b()},"INVITE",x("INVITE",!1),"ACK",x("ACK",!1),"VXACH",x("VXACH",!1),"OPTIONS",x("OPTIONS",!1),"BYE",x("BYE",!1),"CANCEL",x("CANCEL",!1),"REGISTER",x("REGISTER",!1),"SUBSCRIBE",x("SUBSCRIBE",!1),"NOTIFY",x("NOTIFY",!1),"REFER",x("REFER",!1),"PUBLISH",x("PUBLISH",!1),function(){return e=e||{data:{}},e.data.method=b(),e.data.method},function(f){e=e||{data:{}},e.data.status_code=parseInt(f.join(""))},function(){e=e||{data:{}},e.data.reason_phrase=b()},function(){e=e||{data:{}},e.data=b()},function(){var f,v;for(e=e||{data:{}},v=e.data.multi_header.length,f=0;f<v;f++)if(e.data.multi_header[f].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var f;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{f=new ze(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{f=null}e.data.multi_header.push({position:d,offset:C().start.offset,parsed:f})},function(f){f=b().trim(),f[0]==='"'&&(f=f.substring(1,f.length-1)),e=e||{data:{}},e.data.displayName=f},"q",x("q",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.q=f},"expires",x("expires",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.expires=f},function(f){return parseInt(f.join(""))},"0",x("0",!1),function(){return parseFloat(b())},function(f,v){e=e||{data:{}},e.data.params||(e.data.params={}),v===null?v=void 0:v=v[1],e.data.params[f.toLowerCase()]=v},"render",x("render",!0),"session",x("session",!0),"icon",x("icon",!0),"alert",x("alert",!0),function(){e=e||{data:{}},e.startRule==="Content_Disposition"&&(e.data.type=b().toLowerCase())},"handling",x("handling",!0),"optional",x("optional",!0),"required",x("required",!0),function(f){e=e||{data:{}},e.data=parseInt(f.join(""))},function(){e=e||{data:{}},e.data=b()},"text",x("text",!0),"image",x("image",!0),"audio",x("audio",!0),"video",x("video",!0),"application",x("application",!0),"message",x("message",!0),"multipart",x("multipart",!0),"x-",x("x-",!0),function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},function(f){e=e||{data:{}},e.data=f},function(f){e=e||{data:{}},e.data.event=f.toLowerCase()},function(){e=e||{data:{}};var f=e.data.tag;e.data=new ze(e.data.uri,e.data.displayName,e.data.params),f&&e.data.setParam("tag",f)},"tag",x("tag",!0),function(f){e=e||{data:{}},e.data.tag=f},function(f){e=e||{data:{}},e.data=parseInt(f.join(""))},function(f){e=e||{data:{}},e.data=f},function(){e=e||{data:{}},e.data=new ze(e.data.uri,e.data.displayName,e.data.params)},"digest",x("Digest",!0),"realm",x("realm",!0),function(f){e=e||{data:{}},e.data.realm=f},"domain",x("domain",!0),"nonce",x("nonce",!0),function(f){e=e||{data:{}},e.data.nonce=f},"opaque",x("opaque",!0),function(f){e=e||{data:{}},e.data.opaque=f},"stale",x("stale",!0),"true",x("true",!0),function(){e=e||{data:{}},e.data.stale=!0},"false",x("false",!0),function(){e=e||{data:{}},e.data.stale=!1},"algorithm",x("algorithm",!0),"md5",x("MD5",!0),"md5-sess",x("MD5-sess",!0),function(f){e=e||{data:{}},e.data.algorithm=f.toUpperCase()},"qop",x("qop",!0),"auth-int",x("auth-int",!0),"auth",x("auth",!0),function(f){e=e||{data:{}},e.data.qop||(e.data.qop=[]),e.data.qop.push(f.toLowerCase())},function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},function(){var f,v;for(e=e||{data:{}},v=e.data.multi_header.length,f=0;f<v;f++)if(e.data.multi_header[f].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var f;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{f=new ze(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{f=null}e.data.multi_header.push({position:d,offset:C().start.offset,parsed:f})},function(){e=e||{data:{}},e.data=new ze(e.data.uri,e.data.displayName,e.data.params)},function(){e=e||{data:{}},e.data.replaces_from_tag&&e.data.replaces_to_tag||(e.data=-1)},function(){e=e||{data:{}},e.data={call_id:e.data}},"from-tag",x("from-tag",!0),function(f){e=e||{data:{}},e.data.replaces_from_tag=f},"to-tag",x("to-tag",!0),function(f){e=e||{data:{}},e.data.replaces_to_tag=f},"early-only",x("early-only",!0),function(){e=e||{data:{}},e.data.early_only=!0},function(f,v){return v},function(f,v){return A(f,v)},function(f){e=e||{data:{}},e.startRule==="Require"&&(e.data=f||[])},function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},"active",x("active",!0),"pending",x("pending",!0),"terminated",x("terminated",!0),function(){e=e||{data:{}},e.data.state=b()},"reason",x("reason",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.reason=f)},function(f){e=e||{data:{}},typeof f<"u"&&(e.data.expires=f)},"retry_after",x("retry_after",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.retry_after=f)},"deactivated",x("deactivated",!0),"probation",x("probation",!0),"rejected",x("rejected",!0),"timeout",x("timeout",!0),"giveup",x("giveup",!0),"noresource",x("noresource",!0),"invariant",x("invariant",!0),function(f){e=e||{data:{}},e.startRule==="Supported"&&(e.data=f||[])},function(){e=e||{data:{}};var f=e.data.tag;e.data=new ze(e.data.uri,e.data.displayName,e.data.params),f&&e.data.setParam("tag",f)},"ttl",x("ttl",!0),function(f){e=e||{data:{}},e.data.ttl=f},"maddr",x("maddr",!0),function(f){e=e||{data:{}},e.data.maddr=f},"received",x("received",!0),function(f){e=e||{data:{}},e.data.received=f},"branch",x("branch",!0),function(f){e=e||{data:{}},e.data.branch=f},"rport",x("rport",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.rport=f.join(""))},function(f){e=e||{data:{}},e.data.protocol=f},x("UDP",!0),x("TCP",!0),x("TLS",!0),x("SCTP",!0),function(f){e=e||{data:{}},e.data.transport=f},function(){e=e||{data:{}},e.data.host=b()},function(f){e=e||{data:{}},e.data.port=parseInt(f.join(""))},function(f){return parseInt(f.join(""))},function(f){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.deltaSeconds=f)},"refresher",x("refresher",!1),"uas",x("uas",!1),"uac",x("uac",!1),function(f){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.refresher=f)},function(f){e=e||{data:{}},e.startRule==="Min_SE"&&(e.data=f)},"stuns",x("stuns",!0),"stun",x("stun",!0),function(f){e=e||{data:{}},e.data.scheme=f},function(f){e=e||{data:{}},e.data.host=f},"?transport=",x("?transport=",!1),"turns",x("turns",!0),"turn",x("turn",!0),function(f){e=e||{data:{}},e.data.transport=f},function(){e=e||{data:{}},e.data=b()},"Referred-By",x("Referred-By",!1),"b",x("b",!1),"cid",x("cid",!1)],o=[h('2 ""6 7!'),h('4"""5!7#'),h('4$""5!7%'),h(`4&""5!7'`),h(";'.# &;("),h('4(""5!7)'),h('4*""5!7+'),h('2,""6,7-'),h('2.""6.7/'),h('40""5!71'),h('22""6273. &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(";).# &;,"),h('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),h(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),h(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/�#*;$&&&#/'$8":Z" )("'#&'#`),h(';.." &"'),h(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),h(`%%$;2/�#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h('4\\""5!7].# &;3'),h('4^""5!7_'),h('4`""5!7a'),h(';!.) &4b""5!7c'),h('%$;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h('%$;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h(`2T""6T7U.ã &2V""6V7W.× &2f""6f7g.Ë &2h""6h7i.¿ &2:""6:7;.³ &2D""6D7E.§ &22""6273. &28""6879. &2j""6j7k. &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;'.# &;(`),h('%$;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/Ĵ#0ı*;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),h(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),h(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),h(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),h(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),h(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),h(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),h(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),h(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),h(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),h(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),h(`%;//0#;&/'$8":~" )("'#&'#`),h(`%;&/0#;//'$8":~" )("'#&'#`),h(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),h('4""5!7.A &4""5!7.5 &4""5!7.) &;3.# &;.'),h(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),h(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:
$!!)($'#(#'#("'#&'#`),h(';..G &2L""6L7M.; &4""5!7./ &4""5!7.# &;3'),h(`%2j""6j7k/J#4""5!7.5 &4""5!7.) &4""5!7/#$+")("'#&'#`),h(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:$ )($'#(#'#("'#&'#`),h(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),h(`%3""5$7.) &3""5#7/' 8!:!! )`),h(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:# )(#'#("'#&'#`),h("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),h('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),h('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:! )'),h(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:! )"),h(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:# )(#'#("'#&'#`),h('$4""5!7/,#0)*4""5!7&&&#'),h(`%4$""5!7%/?#$4""5!70)*4""5!7&/#$+")("'#&'#`),h(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),h(`%%;Z/³#28""6879/¤$;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2""67/¤#;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2""67/#;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2""67/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2""67/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2""67/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2""67/,#;[/#$+")("'#&'#.ծ &%2""67/,#;Z/#$+")("'#&'#.Տ &%;Z/#2""67/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/$2""67/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2""67/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2""67/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2""67/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!: ! )`),h(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),h(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),h(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#. &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7/,#;!/#$+")("'#&'#.# &;!`),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),h(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),h(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),h(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),h(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),h(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),h(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),h(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),h(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),h(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),h('%$;j/�#*;j&&&#/"!&,)'),h('%$;j/�#*;j&&&#/"!&,)'),h(";k.) &;+.# &;-"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),h(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),h(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),h("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),h("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),h(";.# &;r"),h(`%;/G#;'/>$;s/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h(";M.# &;t"),h(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),h(`%;v.# &;w/J#%26""6677/,#;/#$+")("'#&'#." &"/#$+")("'#&'#`),h(`%2Ð""6Ð7Ñ/:#;/1$;w." &"/#$+#)(#'#("'#&'#`),h(`%24""6475/,#;{/#$+")("'#&'#`),h(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),h(";*.) &;+.# &;-"),h(';+. &;-. &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),h(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),h("$;~0#*;~&"),h(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%%;"/#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),h(";.# &;"),h(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),h('$;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/#0*;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),h("$;y0#*;y&"),h(`%3""5#7Ó/q#24""6475/b$$;!/�#*;!&&&#/L$2J""6J7K/=$$;!/�#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),h('2Õ""6Õ7Ö'),h('2×""6×7Ø'),h('2Ù""6Ù7Ú'),h('2Û""6Û7Ü'),h('2Ý""6Ý7Þ'),h('2ß""6ß7à'),h('2á""6á7â'),h('2ã""6ã7ä'),h('2å""6å7æ'),h('2ç""6ç7è'),h('2é""6é7ê'),h("%;
.Y &;.S &;.M &;.G &;.A &;.; &;.5 &;./ &;.) &;.# &;6/& 8!:ë! )"),h(`%;/G#;'/>$;/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%;/' 8!:ì!! )"),h(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),h("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )"),h(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),h(`%;:.c &%;/Y#$%;A/,#;/#$+")("'#&'#06*%;A/,#;/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),h(`%;L.# &;/]#$%;B/,#;/#$+")("'#&'#06*%;B/,#;/#$+")("'#&'#&/'$8":ð" )("'#&'#`),h(`%;." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),h(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),h(";.) &;.# &; "),h(`%3ò""5!7ó/:#;</1$;/($8#:ô#! )(#'#("'#&'#`),h(`%3õ""5'7ö/:#;</1$;/($8#:÷#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ø!! )"),h(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),h(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),h(";6.) &;T.# &;H"),h(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),h(";¥.# &; "),h(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Č!! )"),h("%;©/& 8!:č! )"),h(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";«.# &;¬"),h('3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;'),h(`3Ę""5'7ę./ &3Ě""5)7ě.# &;`),h(";6.# &;®"),h(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),h(";.# &;6"),h(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),h(";6.# &;H"),h(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Ğ!! )"),h("%;/' 8!:ğ!! )"),h(`%;¶/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),h(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h(`%;L.# &;/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),h(";¹.# &; "),h(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ĥ!! )"),h("%;/' 8!:Ħ!! )"),h(`%$;0#*;&/x#;@/o$;M/f$;?/]$$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),h(";¾"),h(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),h(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),h(";Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À"),h(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),h("%;I/' 8!:Ĭ!! )"),h(`%3ĭ""5&7Į/#;</$;D/
$;Å/|$$%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),h(";t.# &;w"),h(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),h("%;I/' 8!:ı!! )"),h(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),h(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),h(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),h(`%3ń""5#7Ņ/#;</$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŋ!! )"),h(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),h(`%;/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":ō" )("'#&'#`),h(`%;L.O &;.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),h(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),h("%;/& 8!:Ő! )"),h(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &; `),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),h(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;/Y#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŝ!! )"),h(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),h(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;/($8#:ū#! )(#'#("'#&'#.# &; `),h(`3Ŭ""5+7ŭ.k &3Ů""5)7ů._ &3Ű""5(7ű.S &3Ų""5'7ų.G &3Ŵ""5&7ŵ.; &3Ŷ""5*7ŷ./ &3Ÿ""5)7Ź.# &;6`),h(';1." &"'),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),h(`%;L.# &;/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),h(";¹.# &; "),h(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";å.; &;æ.5 &;ç./ &;è.) &;é.# &; "),h(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),h(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),h(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),h(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),h(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),h(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3""5#7Ó.# &;6/' 8!:Ƌ!! )`),h(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),h(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:Ƒ! )"),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),h(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),h(";¾"),h(`%;/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),h(";ô.# &; "),h(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),h(`%;/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),h(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),h("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),h("$;%0#*;%&"),h(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),h(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),h(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;\\.) &;X.# &;/' 8!:Ƣ!! )"),h(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),h('2L""6L7M. &2B""6B7C. &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),h(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),h(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),h(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),h(`%;Ą/#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),h(`%;ă/,#;ă/#$+")("'#&'#`),h(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),h(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),h(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &; /#$+")("'#&'#0<*%;B/2#;ĉ.# &; /#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";.# &;L"),h(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),h(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)];let d=0,c=0;const l=[{line:1,column:1}];let g=0,u=[],y=0,w;if(e.startRule!==void 0){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function b(){return r.substring(c,d)}function C(){return R(c,d)}function x(f,v){return{type:"literal",text:f,ignoreCase:v}}function p(f,v,m){return{type:"class",parts:f,inverted:v,ignoreCase:m}}function E(){return{type:"end"}}function _(f){let v=l[f],m;if(v)return v;for(m=f-1;!l[m];)m--;for(v=l[m],v={line:v.line,column:v.column};m<f;)r.charCodeAt(m)===10?(v.line++,v.column=1):v.column++,m++;return l[f]=v,v}function R(f,v){const m=_(f),U=_(v);return{source:s,start:{offset:f,line:m.line,column:m.column},end:{offset:v,line:U.line,column:U.column}}}function T(f){d<g||(d>g&&(g=d,u=[]),u.push(f))}function F(f,v,m){return new yr(yr.buildMessage(f,v),f,v,m)}function h(f){return f.split("").map(v=>v.charCodeAt(0)-32)}function O(f){const v=o[f];let m=0;const U=[];let j=v.length;const X=[],G=[];let ne;for(;;){for(;m<j;)switch(v[m]){case 0:G.push(a[v[m+1]]),m+=2;break;case 1:G.push(void 0),m++;break;case 2:G.push(null),m++;break;case 3:G.push(t),m++;break;case 4:G.push([]),m++;break;case 5:G.push(d),m++;break;case 6:G.pop(),m++;break;case 7:d=G.pop(),m++;break;case 8:G.length-=v[m+1],m+=2;break;case 9:G.splice(-2,1),m++;break;case 10:G[G.length-2].push(G.pop()),m++;break;case 11:G.push(G.splice(G.length-v[m+1],v[m+1])),m+=2;break;case 12:G.push(r.substring(G.pop(),d)),m++;break;case 13:X.push(j),U.push(m+3+v[m+1]+v[m+2]),G[G.length-1]?(j=m+3+v[m+1],m+=3):(j=m+3+v[m+1]+v[m+2],m+=3+v[m+1]);break;case 14:X.push(j),U.push(m+3+v[m+1]+v[m+2]),G[G.length-1]===t?(j=m+3+v[m+1],m+=3):(j=m+3+v[m+1]+v[m+2],m+=3+v[m+1]);break;case 15:X.push(j),U.push(m+3+v[m+1]+v[m+2]),G[G.length-1]!==t?(j=m+3+v[m+1],m+=3):(j=m+3+v[m+1]+v[m+2],m+=3+v[m+1]);break;case 16:G[G.length-1]!==t?(X.push(j),U.push(m),j=m+2+v[m+1],m+=2):m+=2+v[m+1];break;case 17:X.push(j),U.push(m+3+v[m+1]+v[m+2]),r.length>d?(j=m+3+v[m+1],m+=3):(j=m+3+v[m+1]+v[m+2],m+=3+v[m+1]);break;case 18:X.push(j),U.push(m+4+v[m+2]+v[m+3]),r.substr(d,a[v[m+1]].length)===a[v[m+1]]?(j=m+4+v[m+2],m+=4):(j=m+4+v[m+2]+v[m+3],m+=4+v[m+2]);break;case 19:X.push(j),U.push(m+4+v[m+2]+v[m+3]),r.substr(d,a[v[m+1]].length).toLowerCase()===a[v[m+1]]?(j=m+4+v[m+2],m+=4):(j=m+4+v[m+2]+v[m+3],m+=4+v[m+2]);break;case 20:X.push(j),U.push(m+4+v[m+2]+v[m+3]),a[v[m+1]].test(r.charAt(d))?(j=m+4+v[m+2],m+=4):(j=m+4+v[m+2]+v[m+3],m+=4+v[m+2]);break;case 21:G.push(r.substr(d,v[m+1])),d+=v[m+1],m+=2;break;case 22:G.push(a[v[m+1]]),d+=a[v[m+1]].length,m+=2;break;case 23:G.push(t),y===0&&T(a[v[m+1]]),m+=2;break;case 24:c=G[G.length-1-v[m+1]],m+=2;break;case 25:c=d,m++;break;case 26:ne=v.slice(m+4,m+4+v[m+3]).map(function(he){return G[G.length-1-he]}),G.splice(G.length-v[m+2],v[m+2],a[v[m+1]].apply(null,ne)),m+=4+v[m+3];break;case 27:G.push(O(v[m+1])),m+=2;break;case 28:y++,m++;break;case 29:y--,m++;break;default:throw new Error("Invalid opcode: "+v[m]+".")}if(X.length>0)j=X.pop(),m=U.pop();else break}return G[0]}e.data={};function A(f,v){return[f].concat(v)}if(w=O(n),w!==t&&d===r.length)return w;throw w!==t&&d<r.length&&T(E()),F(u,g<r.length?r.charAt(g):null,g<r.length?R(g,g+1):R(g,g))}const W0=Y0;var Ie;(function(r){function e(i,n){const a={startRule:n};try{W0(i,a)}catch{a.data=-1}return a.data}r.parse=e;function t(i){const n=r.parse(i,"Name_Addr_Header");return n!==-1?n:void 0}r.nameAddrHeaderParse=t;function s(i){const n=r.parse(i,"SIP_URI");return n!==-1?n:void 0}r.URIParse=s})(Ie=Ie||(Ie={}));const G0={100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"};function or(r,e=32){let t="";for(let s=0;s<r;s++){const i=Math.floor(Math.random()*e);t+=i.toString(e)}return t}function cs(r){return G0[r]||""}function ls(){return or(10)}function wt(r){const e={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},t=r.toLowerCase().replace(/_/g,"-").split("-"),s=t.length;let i="";for(let n=0;n<s;n++)n!==0&&(i+="-"),i+=t[n].charAt(0).toUpperCase()+t[n].substring(1);return e[i]&&(i=e[i]),i}function qr(r){return encodeURIComponent(r).replace(/%[A-F\d]{2}/g,"U").length}class Da{constructor(){this.headers={}}addHeader(e,t){const s={raw:t};e=wt(e),this.headers[e]?this.headers[e].push(s):this.headers[e]=[s]}getHeader(e){const t=this.headers[wt(e)];if(t){if(t[0])return t[0].raw}else return}getHeaders(e){const t=this.headers[wt(e)],s=[];if(!t)return[];for(const i of t)s.push(i.raw);return s}hasHeader(e){return!!this.headers[wt(e)]}parseHeader(e,t=0){if(e=wt(e),this.headers[e]){if(t>=this.headers[e].length)return}else return;const s=this.headers[e][t],i=s.raw;if(s.parsed)return s.parsed;const n=Ie.parse(i,e.replace(/-/g,"_"));if(n===-1){this.headers[e].splice(t,1);return}else return s.parsed=n,n}s(e,t=0){return this.parseHeader(e,t)}setHeader(e,t){this.headers[wt(e)]=[{raw:t}]}toString(){return this.data}}class wr extends Da{constructor(){super()}}class Gt extends Da{constructor(){super()}}class cr{constructor(e,t,s,i,n,a,o){this.headers={},this.extraHeaders=[],this.options=cr.getDefaultOptions(),n&&(this.options=Object.assign(Object.assign({},this.options),n),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),a&&a.length&&(this.extraHeaders=a.slice()),o&&(this.body={body:o.content,contentType:o.contentType}),this.method=e,this.ruri=t.clone(),this.fromURI=s.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:ls(),this.from=cr.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.clone(),this.toTag=this.options.toTag,this.to=cr.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+or(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}static getDefaultOptions(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}}static makeNameAddrHeader(e,t,s){const i={};return s&&(i.tag=s),new ze(e,t,i)}getHeader(e){const t=this.headers[wt(e)];if(t){if(t[0])return t[0]}else{const s=new RegExp("^\\s*"+e+"\\s*:","i");for(const i of this.extraHeaders)if(s.test(i))return i.substring(i.indexOf(":")+1).trim()}}getHeaders(e){const t=[],s=this.headers[wt(e)];if(s)for(const i of s)t.push(i);else{const i=new RegExp("^\\s*"+e+"\\s*:","i");for(const n of this.extraHeaders)i.test(n)&&t.push(n.substring(n.indexOf(":")+1).trim())}return t}hasHeader(e){if(this.headers[wt(e)])return!0;{const t=new RegExp("^\\s*"+e+"\\s*:","i");for(const s of this.extraHeaders)if(t.test(s))return!0}return!1}setHeader(e,t){this.headers[wt(e)]=t instanceof Array?t:[t]}setViaHeader(e,t){this.options.hackViaTcp&&(t="TCP");let s="SIP/2.0/"+t;s+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(s+=";rport"),this.setHeader("via",s),this.branch=e}toString(){let e="";e+=this.method+" "+this.ruri.toRaw()+` SIP/2.0\r
|
|
164
|
+
`,!1),/^[0-9]/,p([["0","9"]],!1,!1),/^[a-zA-Z]/,p([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,p([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,p([["\0","ÿ"]],!1,!1),/^["]/,p(['"'],!1,!1)," ",x(" ",!1)," ",x(" ",!1),/^[a-zA-Z0-9]/,p([["a","z"],["A","Z"],["0","9"]],!1,!1),";",x(";",!1),"/",x("/",!1),"?",x("?",!1),":",x(":",!1),"@",x("@",!1),"&",x("&",!1),"=",x("=",!1),"+",x("+",!1),"$",x("$",!1),",",x(",",!1),"-",x("-",!1),"_",x("_",!1),".",x(".",!1),"!",x("!",!1),"~",x("~",!1),"*",x("*",!1),"'",x("'",!1),"(",x("(",!1),")",x(")",!1),"%",x("%",!1),function(){return" "},function(){return":"},/^[!-~]/,p([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,p([["",""]],!1,!1),/^[\x80-\xBF]/,p([["","¿"]],!1,!1),/^[a-f]/,p([["a","f"]],!1,!1),"`",x("`",!1),"<",x("<",!1),">",x(">",!1),"\\",x("\\",!1),"[",x("[",!1),"]",x("]",!1),"{",x("{",!1),"}",x("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,p([["!","'"]],!1,!1),/^[*-[]/,p([["*","["]],!1,!1),/^[\]-~]/,p([["]","~"]],!1,!1),function(u){return u},/^[#-[]/,p([["#","["]],!1,!1),/^[\0-\t]/,p([["\0"," "]],!1,!1),/^[\v-\f]/,p([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,p([["",""]],!1,!1),function(){e=e||{data:{}},e.data.uri=new yt(e.data.scheme,e.data.user,e.data.host,e.data.port),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port},function(){e=e||{data:{}},e.data.uri=new yt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params,e.startRule==="SIP_URI"&&(e.data=e.data.uri)},"sips",x("sips",!0),"sip",x("sip",!0),function(u){e=e||{data:{}},e.data.scheme=u},function(){e=e||{data:{}},e.data.user=decodeURIComponent(b().slice(0,-1))},function(){e=e||{data:{}},e.data.password=b()},function(){return e=e||{data:{}},e.data.host=b(),e.data.host},function(){return e=e||{data:{}},e.data.host_type="domain",b()},/^[a-zA-Z0-9_\-]/,p([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,p([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",b()},"::",x("::",!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",b()},function(){return e=e||{data:{}},e.data.host_type="IPv4",b()},"25",x("25",!1),/^[0-5]/,p([["0","5"]],!1,!1),"2",x("2",!1),/^[0-4]/,p([["0","4"]],!1,!1),"1",x("1",!1),/^[1-9]/,p([["1","9"]],!1,!1),function(u){return e=e||{data:{}},u=parseInt(u.join("")),e.data.port=u,u},"transport=",x("transport=",!0),"udp",x("udp",!0),"tcp",x("tcp",!0),"sctp",x("sctp",!0),"tls",x("tls",!0),function(u){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.transport=u.toLowerCase()},"user=",x("user=",!0),"phone",x("phone",!0),"ip",x("ip",!0),function(u){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.user=u.toLowerCase()},"method=",x("method=",!0),function(u){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.method=u},"ttl=",x("ttl=",!0),function(u){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.ttl=u},"maddr=",x("maddr=",!0),function(u){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.maddr=u},"lr",x("lr",!0),function(){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.lr=void 0},function(u,v){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),v===null?v=void 0:v=v[1],e.data.uri_params[u.toLowerCase()]=v},function(u,v){u=u.join("").toLowerCase(),v=v.join(""),e=e||{data:{}},e.data.uri_headers||(e.data.uri_headers={}),e.data.uri_headers[u]?e.data.uri_headers[u].push(v):e.data.uri_headers[u]=[v]},function(){e=e||{data:{}},e.startRule==="Refer_To"&&(e.data.uri=new yt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params)},"//",x("//",!1),function(){e=e||{data:{}},e.data.scheme=b()},x("SIP",!0),function(){e=e||{data:{}},e.data.sip_version=b()},"INVITE",x("INVITE",!1),"ACK",x("ACK",!1),"VXACH",x("VXACH",!1),"OPTIONS",x("OPTIONS",!1),"BYE",x("BYE",!1),"CANCEL",x("CANCEL",!1),"REGISTER",x("REGISTER",!1),"SUBSCRIBE",x("SUBSCRIBE",!1),"NOTIFY",x("NOTIFY",!1),"REFER",x("REFER",!1),"PUBLISH",x("PUBLISH",!1),function(){return e=e||{data:{}},e.data.method=b(),e.data.method},function(u){e=e||{data:{}},e.data.status_code=parseInt(u.join(""))},function(){e=e||{data:{}},e.data.reason_phrase=b()},function(){e=e||{data:{}},e.data=b()},function(){var u,v;for(e=e||{data:{}},v=e.data.multi_header.length,u=0;u<v;u++)if(e.data.multi_header[u].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var u;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{u=new ze(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{u=null}e.data.multi_header.push({position:d,offset:C().start.offset,parsed:u})},function(u){u=b().trim(),u[0]==='"'&&(u=u.substring(1,u.length-1)),e=e||{data:{}},e.data.displayName=u},"q",x("q",!0),function(u){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.q=u},"expires",x("expires",!0),function(u){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.expires=u},function(u){return parseInt(u.join(""))},"0",x("0",!1),function(){return parseFloat(b())},function(u,v){e=e||{data:{}},e.data.params||(e.data.params={}),v===null?v=void 0:v=v[1],e.data.params[u.toLowerCase()]=v},"render",x("render",!0),"session",x("session",!0),"icon",x("icon",!0),"alert",x("alert",!0),function(){e=e||{data:{}},e.startRule==="Content_Disposition"&&(e.data.type=b().toLowerCase())},"handling",x("handling",!0),"optional",x("optional",!0),"required",x("required",!0),function(u){e=e||{data:{}},e.data=parseInt(u.join(""))},function(){e=e||{data:{}},e.data=b()},"text",x("text",!0),"image",x("image",!0),"audio",x("audio",!0),"video",x("video",!0),"application",x("application",!0),"message",x("message",!0),"multipart",x("multipart",!0),"x-",x("x-",!0),function(u){e=e||{data:{}},e.data.value=parseInt(u.join(""))},function(u){e=e||{data:{}},e.data=u},function(u){e=e||{data:{}},e.data.event=u.toLowerCase()},function(){e=e||{data:{}};var u=e.data.tag;e.data=new ze(e.data.uri,e.data.displayName,e.data.params),u&&e.data.setParam("tag",u)},"tag",x("tag",!0),function(u){e=e||{data:{}},e.data.tag=u},function(u){e=e||{data:{}},e.data=parseInt(u.join(""))},function(u){e=e||{data:{}},e.data=u},function(){e=e||{data:{}},e.data=new ze(e.data.uri,e.data.displayName,e.data.params)},"digest",x("Digest",!0),"realm",x("realm",!0),function(u){e=e||{data:{}},e.data.realm=u},"domain",x("domain",!0),"nonce",x("nonce",!0),function(u){e=e||{data:{}},e.data.nonce=u},"opaque",x("opaque",!0),function(u){e=e||{data:{}},e.data.opaque=u},"stale",x("stale",!0),"true",x("true",!0),function(){e=e||{data:{}},e.data.stale=!0},"false",x("false",!0),function(){e=e||{data:{}},e.data.stale=!1},"algorithm",x("algorithm",!0),"md5",x("MD5",!0),"md5-sess",x("MD5-sess",!0),function(u){e=e||{data:{}},e.data.algorithm=u.toUpperCase()},"qop",x("qop",!0),"auth-int",x("auth-int",!0),"auth",x("auth",!0),function(u){e=e||{data:{}},e.data.qop||(e.data.qop=[]),e.data.qop.push(u.toLowerCase())},function(u){e=e||{data:{}},e.data.value=parseInt(u.join(""))},function(){var u,v;for(e=e||{data:{}},v=e.data.multi_header.length,u=0;u<v;u++)if(e.data.multi_header[u].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var u;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{u=new ze(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{u=null}e.data.multi_header.push({position:d,offset:C().start.offset,parsed:u})},function(){e=e||{data:{}},e.data=new ze(e.data.uri,e.data.displayName,e.data.params)},function(){e=e||{data:{}},e.data.replaces_from_tag&&e.data.replaces_to_tag||(e.data=-1)},function(){e=e||{data:{}},e.data={call_id:e.data}},"from-tag",x("from-tag",!0),function(u){e=e||{data:{}},e.data.replaces_from_tag=u},"to-tag",x("to-tag",!0),function(u){e=e||{data:{}},e.data.replaces_to_tag=u},"early-only",x("early-only",!0),function(){e=e||{data:{}},e.data.early_only=!0},function(u,v){return v},function(u,v){return A(u,v)},function(u){e=e||{data:{}},e.startRule==="Require"&&(e.data=u||[])},function(u){e=e||{data:{}},e.data.value=parseInt(u.join(""))},"active",x("active",!0),"pending",x("pending",!0),"terminated",x("terminated",!0),function(){e=e||{data:{}},e.data.state=b()},"reason",x("reason",!0),function(u){e=e||{data:{}},typeof u<"u"&&(e.data.reason=u)},function(u){e=e||{data:{}},typeof u<"u"&&(e.data.expires=u)},"retry_after",x("retry_after",!0),function(u){e=e||{data:{}},typeof u<"u"&&(e.data.retry_after=u)},"deactivated",x("deactivated",!0),"probation",x("probation",!0),"rejected",x("rejected",!0),"timeout",x("timeout",!0),"giveup",x("giveup",!0),"noresource",x("noresource",!0),"invariant",x("invariant",!0),function(u){e=e||{data:{}},e.startRule==="Supported"&&(e.data=u||[])},function(){e=e||{data:{}};var u=e.data.tag;e.data=new ze(e.data.uri,e.data.displayName,e.data.params),u&&e.data.setParam("tag",u)},"ttl",x("ttl",!0),function(u){e=e||{data:{}},e.data.ttl=u},"maddr",x("maddr",!0),function(u){e=e||{data:{}},e.data.maddr=u},"received",x("received",!0),function(u){e=e||{data:{}},e.data.received=u},"branch",x("branch",!0),function(u){e=e||{data:{}},e.data.branch=u},"rport",x("rport",!0),function(u){e=e||{data:{}},typeof u<"u"&&(e.data.rport=u.join(""))},function(u){e=e||{data:{}},e.data.protocol=u},x("UDP",!0),x("TCP",!0),x("TLS",!0),x("SCTP",!0),function(u){e=e||{data:{}},e.data.transport=u},function(){e=e||{data:{}},e.data.host=b()},function(u){e=e||{data:{}},e.data.port=parseInt(u.join(""))},function(u){return parseInt(u.join(""))},function(u){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.deltaSeconds=u)},"refresher",x("refresher",!1),"uas",x("uas",!1),"uac",x("uac",!1),function(u){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.refresher=u)},function(u){e=e||{data:{}},e.startRule==="Min_SE"&&(e.data=u)},"stuns",x("stuns",!0),"stun",x("stun",!0),function(u){e=e||{data:{}},e.data.scheme=u},function(u){e=e||{data:{}},e.data.host=u},"?transport=",x("?transport=",!1),"turns",x("turns",!0),"turn",x("turn",!0),function(u){e=e||{data:{}},e.data.transport=u},function(){e=e||{data:{}},e.data=b()},"Referred-By",x("Referred-By",!1),"b",x("b",!1),"cid",x("cid",!1)],o=[h('2 ""6 7!'),h('4"""5!7#'),h('4$""5!7%'),h(`4&""5!7'`),h(";'.# &;("),h('4(""5!7)'),h('4*""5!7+'),h('2,""6,7-'),h('2.""6.7/'),h('40""5!71'),h('22""6273. &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(";).# &;,"),h('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),h(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),h(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/�#*;$&&&#/'$8":Z" )("'#&'#`),h(';.." &"'),h(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),h(`%%$;2/�#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h('4\\""5!7].# &;3'),h('4^""5!7_'),h('4`""5!7a'),h(';!.) &4b""5!7c'),h('%$;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h('%$;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h(`2T""6T7U.ã &2V""6V7W.× &2f""6f7g.Ë &2h""6h7i.¿ &2:""6:7;.³ &2D""6D7E.§ &22""6273. &28""6879. &2j""6j7k. &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;'.# &;(`),h('%$;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/Ĵ#0ı*;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),h(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),h(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),h(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),h(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),h(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),h(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),h(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),h(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),h(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),h(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),h(`%;//0#;&/'$8":~" )("'#&'#`),h(`%;&/0#;//'$8":~" )("'#&'#`),h(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),h('4""5!7.A &4""5!7.5 &4""5!7.) &;3.# &;.'),h(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),h(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:
$!!)($'#(#'#("'#&'#`),h(';..G &2L""6L7M.; &4""5!7./ &4""5!7.# &;3'),h(`%2j""6j7k/J#4""5!7.5 &4""5!7.) &4""5!7/#$+")("'#&'#`),h(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:$ )($'#(#'#("'#&'#`),h(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),h(`%3""5$7.) &3""5#7/' 8!:!! )`),h(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:# )(#'#("'#&'#`),h("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),h('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),h('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:! )'),h(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:! )"),h(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:# )(#'#("'#&'#`),h('$4""5!7/,#0)*4""5!7&&&#'),h(`%4$""5!7%/?#$4""5!70)*4""5!7&/#$+")("'#&'#`),h(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),h(`%%;Z/³#28""6879/¤$;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2""67/¤#;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2""67/#;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2""67/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2""67/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2""67/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2""67/,#;[/#$+")("'#&'#.ծ &%2""67/,#;Z/#$+")("'#&'#.Տ &%;Z/#2""67/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/$2""67/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2""67/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2""67/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2""67/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!: ! )`),h(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),h(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),h(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#. &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7/,#;!/#$+")("'#&'#.# &;!`),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),h(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),h(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),h(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),h(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),h(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),h(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),h(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),h(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),h(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),h('%$;j/�#*;j&&&#/"!&,)'),h('%$;j/�#*;j&&&#/"!&,)'),h(";k.) &;+.# &;-"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),h(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),h(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),h("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),h("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),h(";.# &;r"),h(`%;/G#;'/>$;s/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h(";M.# &;t"),h(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),h(`%;v.# &;w/J#%26""6677/,#;/#$+")("'#&'#." &"/#$+")("'#&'#`),h(`%2Ð""6Ð7Ñ/:#;/1$;w." &"/#$+#)(#'#("'#&'#`),h(`%24""6475/,#;{/#$+")("'#&'#`),h(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),h(";*.) &;+.# &;-"),h(';+. &;-. &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),h(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),h("$;~0#*;~&"),h(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%%;"/#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),h(";.# &;"),h(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),h('$;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/#0*;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),h("$;y0#*;y&"),h(`%3""5#7Ó/q#24""6475/b$$;!/�#*;!&&&#/L$2J""6J7K/=$$;!/�#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),h('2Õ""6Õ7Ö'),h('2×""6×7Ø'),h('2Ù""6Ù7Ú'),h('2Û""6Û7Ü'),h('2Ý""6Ý7Þ'),h('2ß""6ß7à'),h('2á""6á7â'),h('2ã""6ã7ä'),h('2å""6å7æ'),h('2ç""6ç7è'),h('2é""6é7ê'),h("%;
.Y &;.S &;.M &;.G &;.A &;.; &;.5 &;./ &;.) &;.# &;6/& 8!:ë! )"),h(`%;/G#;'/>$;/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%;/' 8!:ì!! )"),h(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),h("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )"),h(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),h(`%;:.c &%;/Y#$%;A/,#;/#$+")("'#&'#06*%;A/,#;/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),h(`%;L.# &;/]#$%;B/,#;/#$+")("'#&'#06*%;B/,#;/#$+")("'#&'#&/'$8":ð" )("'#&'#`),h(`%;." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),h(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),h(";.) &;.# &; "),h(`%3ò""5!7ó/:#;</1$;/($8#:ô#! )(#'#("'#&'#`),h(`%3õ""5'7ö/:#;</1$;/($8#:÷#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ø!! )"),h(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),h(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),h(";6.) &;T.# &;H"),h(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),h(";¥.# &; "),h(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Č!! )"),h("%;©/& 8!:č! )"),h(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";«.# &;¬"),h('3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;'),h(`3Ę""5'7ę./ &3Ě""5)7ě.# &;`),h(";6.# &;®"),h(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),h(";.# &;6"),h(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),h(";6.# &;H"),h(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Ğ!! )"),h("%;/' 8!:ğ!! )"),h(`%;¶/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),h(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h(`%;L.# &;/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),h(";¹.# &; "),h(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ĥ!! )"),h("%;/' 8!:Ħ!! )"),h(`%$;0#*;&/x#;@/o$;M/f$;?/]$$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),h(";¾"),h(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),h(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),h(";Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À"),h(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),h("%;I/' 8!:Ĭ!! )"),h(`%3ĭ""5&7Į/#;</$;D/
$;Å/|$$%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),h(";t.# &;w"),h(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),h("%;I/' 8!:ı!! )"),h(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),h(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),h(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),h(`%3ń""5#7Ņ/#;</$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŋ!! )"),h(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),h(`%;/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":ō" )("'#&'#`),h(`%;L.O &;.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),h(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),h("%;/& 8!:Ő! )"),h(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &; `),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),h(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;/Y#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŝ!! )"),h(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),h(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;/($8#:ū#! )(#'#("'#&'#.# &; `),h(`3Ŭ""5+7ŭ.k &3Ů""5)7ů._ &3Ű""5(7ű.S &3Ų""5'7ų.G &3Ŵ""5&7ŵ.; &3Ŷ""5*7ŷ./ &3Ÿ""5)7Ź.# &;6`),h(';1." &"'),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),h(`%;L.# &;/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),h(";¹.# &; "),h(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";å.; &;æ.5 &;ç./ &;è.) &;é.# &; "),h(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),h(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),h(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),h(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),h(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),h(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3""5#7Ó.# &;6/' 8!:Ƌ!! )`),h(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),h(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:Ƒ! )"),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),h(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),h(";¾"),h(`%;/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),h(";ô.# &; "),h(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),h(`%;/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),h(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),h("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),h("$;%0#*;%&"),h(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),h(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),h(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;\\.) &;X.# &;/' 8!:Ƣ!! )"),h(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),h('2L""6L7M. &2B""6B7C. &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),h(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),h(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),h(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),h(`%;Ą/#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),h(`%;ă/,#;ă/#$+")("'#&'#`),h(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),h(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),h(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &; /#$+")("'#&'#0<*%;B/2#;ĉ.# &; /#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";.# &;L"),h(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),h(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)];let d=0,c=0;const l=[{line:1,column:1}];let g=0,f=[],w=0,y;if(e.startRule!==void 0){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function b(){return r.substring(c,d)}function C(){return R(c,d)}function x(u,v){return{type:"literal",text:u,ignoreCase:v}}function p(u,v,m){return{type:"class",parts:u,inverted:v,ignoreCase:m}}function E(){return{type:"end"}}function _(u){let v=l[u],m;if(v)return v;for(m=u-1;!l[m];)m--;for(v=l[m],v={line:v.line,column:v.column};m<u;)r.charCodeAt(m)===10?(v.line++,v.column=1):v.column++,m++;return l[u]=v,v}function R(u,v){const m=_(u),U=_(v);return{source:s,start:{offset:u,line:m.line,column:m.column},end:{offset:v,line:U.line,column:U.column}}}function T(u){d<g||(d>g&&(g=d,f=[]),f.push(u))}function F(u,v,m){return new yr(yr.buildMessage(u,v),u,v,m)}function h(u){return u.split("").map(v=>v.charCodeAt(0)-32)}function O(u){const v=o[u];let m=0;const U=[];let j=v.length;const J=[],V=[];let ne;for(;;){for(;m<j;)switch(v[m]){case 0:V.push(a[v[m+1]]),m+=2;break;case 1:V.push(void 0),m++;break;case 2:V.push(null),m++;break;case 3:V.push(t),m++;break;case 4:V.push([]),m++;break;case 5:V.push(d),m++;break;case 6:V.pop(),m++;break;case 7:d=V.pop(),m++;break;case 8:V.length-=v[m+1],m+=2;break;case 9:V.splice(-2,1),m++;break;case 10:V[V.length-2].push(V.pop()),m++;break;case 11:V.push(V.splice(V.length-v[m+1],v[m+1])),m+=2;break;case 12:V.push(r.substring(V.pop(),d)),m++;break;case 13:J.push(j),U.push(m+3+v[m+1]+v[m+2]),V[V.length-1]?(j=m+3+v[m+1],m+=3):(j=m+3+v[m+1]+v[m+2],m+=3+v[m+1]);break;case 14:J.push(j),U.push(m+3+v[m+1]+v[m+2]),V[V.length-1]===t?(j=m+3+v[m+1],m+=3):(j=m+3+v[m+1]+v[m+2],m+=3+v[m+1]);break;case 15:J.push(j),U.push(m+3+v[m+1]+v[m+2]),V[V.length-1]!==t?(j=m+3+v[m+1],m+=3):(j=m+3+v[m+1]+v[m+2],m+=3+v[m+1]);break;case 16:V[V.length-1]!==t?(J.push(j),U.push(m),j=m+2+v[m+1],m+=2):m+=2+v[m+1];break;case 17:J.push(j),U.push(m+3+v[m+1]+v[m+2]),r.length>d?(j=m+3+v[m+1],m+=3):(j=m+3+v[m+1]+v[m+2],m+=3+v[m+1]);break;case 18:J.push(j),U.push(m+4+v[m+2]+v[m+3]),r.substr(d,a[v[m+1]].length)===a[v[m+1]]?(j=m+4+v[m+2],m+=4):(j=m+4+v[m+2]+v[m+3],m+=4+v[m+2]);break;case 19:J.push(j),U.push(m+4+v[m+2]+v[m+3]),r.substr(d,a[v[m+1]].length).toLowerCase()===a[v[m+1]]?(j=m+4+v[m+2],m+=4):(j=m+4+v[m+2]+v[m+3],m+=4+v[m+2]);break;case 20:J.push(j),U.push(m+4+v[m+2]+v[m+3]),a[v[m+1]].test(r.charAt(d))?(j=m+4+v[m+2],m+=4):(j=m+4+v[m+2]+v[m+3],m+=4+v[m+2]);break;case 21:V.push(r.substr(d,v[m+1])),d+=v[m+1],m+=2;break;case 22:V.push(a[v[m+1]]),d+=a[v[m+1]].length,m+=2;break;case 23:V.push(t),w===0&&T(a[v[m+1]]),m+=2;break;case 24:c=V[V.length-1-v[m+1]],m+=2;break;case 25:c=d,m++;break;case 26:ne=v.slice(m+4,m+4+v[m+3]).map(function(he){return V[V.length-1-he]}),V.splice(V.length-v[m+2],v[m+2],a[v[m+1]].apply(null,ne)),m+=4+v[m+3];break;case 27:V.push(O(v[m+1])),m+=2;break;case 28:w++,m++;break;case 29:w--,m++;break;default:throw new Error("Invalid opcode: "+v[m]+".")}if(J.length>0)j=J.pop(),m=U.pop();else break}return V[0]}e.data={};function A(u,v){return[u].concat(v)}if(y=O(n),y!==t&&d===r.length)return y;throw y!==t&&d<r.length&&T(E()),F(f,g<r.length?r.charAt(g):null,g<r.length?R(g,g+1):R(g,g))}const W0=Y0;var Ie;(function(r){function e(i,n){const a={startRule:n};try{W0(i,a)}catch{a.data=-1}return a.data}r.parse=e;function t(i){const n=r.parse(i,"Name_Addr_Header");return n!==-1?n:void 0}r.nameAddrHeaderParse=t;function s(i){const n=r.parse(i,"SIP_URI");return n!==-1?n:void 0}r.URIParse=s})(Ie=Ie||(Ie={}));const G0={100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"};function or(r,e=32){let t="";for(let s=0;s<r;s++){const i=Math.floor(Math.random()*e);t+=i.toString(e)}return t}function cs(r){return G0[r]||""}function ls(){return or(10)}function wt(r){const e={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},t=r.toLowerCase().replace(/_/g,"-").split("-"),s=t.length;let i="";for(let n=0;n<s;n++)n!==0&&(i+="-"),i+=t[n].charAt(0).toUpperCase()+t[n].substring(1);return e[i]&&(i=e[i]),i}function qr(r){return encodeURIComponent(r).replace(/%[A-F\d]{2}/g,"U").length}class Da{constructor(){this.headers={}}addHeader(e,t){const s={raw:t};e=wt(e),this.headers[e]?this.headers[e].push(s):this.headers[e]=[s]}getHeader(e){const t=this.headers[wt(e)];if(t){if(t[0])return t[0].raw}else return}getHeaders(e){const t=this.headers[wt(e)],s=[];if(!t)return[];for(const i of t)s.push(i.raw);return s}hasHeader(e){return!!this.headers[wt(e)]}parseHeader(e,t=0){if(e=wt(e),this.headers[e]){if(t>=this.headers[e].length)return}else return;const s=this.headers[e][t],i=s.raw;if(s.parsed)return s.parsed;const n=Ie.parse(i,e.replace(/-/g,"_"));if(n===-1){this.headers[e].splice(t,1);return}else return s.parsed=n,n}s(e,t=0){return this.parseHeader(e,t)}setHeader(e,t){this.headers[wt(e)]=[{raw:t}]}toString(){return this.data}}class wr extends Da{constructor(){super()}}class Gt extends Da{constructor(){super()}}class cr{constructor(e,t,s,i,n,a,o){this.headers={},this.extraHeaders=[],this.options=cr.getDefaultOptions(),n&&(this.options=Object.assign(Object.assign({},this.options),n),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),a&&a.length&&(this.extraHeaders=a.slice()),o&&(this.body={body:o.content,contentType:o.contentType}),this.method=e,this.ruri=t.clone(),this.fromURI=s.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:ls(),this.from=cr.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.clone(),this.toTag=this.options.toTag,this.to=cr.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+or(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}static getDefaultOptions(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}}static makeNameAddrHeader(e,t,s){const i={};return s&&(i.tag=s),new ze(e,t,i)}getHeader(e){const t=this.headers[wt(e)];if(t){if(t[0])return t[0]}else{const s=new RegExp("^\\s*"+e+"\\s*:","i");for(const i of this.extraHeaders)if(s.test(i))return i.substring(i.indexOf(":")+1).trim()}}getHeaders(e){const t=[],s=this.headers[wt(e)];if(s)for(const i of s)t.push(i);else{const i=new RegExp("^\\s*"+e+"\\s*:","i");for(const n of this.extraHeaders)i.test(n)&&t.push(n.substring(n.indexOf(":")+1).trim())}return t}hasHeader(e){if(this.headers[wt(e)])return!0;{const t=new RegExp("^\\s*"+e+"\\s*:","i");for(const s of this.extraHeaders)if(t.test(s))return!0}return!1}setHeader(e,t){this.headers[wt(e)]=t instanceof Array?t:[t]}setViaHeader(e,t){this.options.hackViaTcp&&(t="TCP");let s="SIP/2.0/"+t;s+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(s+=";rport"),this.setHeader("via",s),this.branch=e}toString(){let e="";e+=this.method+" "+this.ruri.toRaw()+` SIP/2.0\r
|
|
165
165
|
`;for(const t in this.headers)if(this.headers[t])for(const s of this.headers[t])e+=t+": "+s+`\r
|
|
166
166
|
`;for(const t of this.extraHeaders)e+=t.trim()+`\r
|
|
167
167
|
`;return e+="Supported: "+this.options.optionTags.join(", ")+`\r
|
|
@@ -175,10 +175,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
175
175
|
\r
|
|
176
176
|
`:e+=`Content-Length: 0\r
|
|
177
177
|
\r
|
|
178
|
-
`,e}}function Aa(r){return r==="application/sdp"?"session":"render"}function ds(r){const e=typeof r=="string"?r:r.body,t=typeof r=="string"?"application/sdp":r.contentType;return{contentDisposition:Aa(t),contentType:t,content:e}}function Sa(r){return r&&typeof r.content=="string"&&typeof r.contentType=="string"&&r.contentDisposition===void 0?!0:typeof r.contentDisposition=="string"}function Ur(r){let e,t,s;if(r instanceof wr&&r.body){const i=r.parseHeader("Content-Disposition");e=i?i.type:void 0,t=r.parseHeader("Content-Type"),s=r.body}if(r instanceof Gt&&r.body){const i=r.parseHeader("Content-Disposition");e=i?i.type:void 0,t=r.parseHeader("Content-Type"),s=r.body}if(r instanceof cr&&r.body)if(e=r.getHeader("Content-Disposition"),t=r.getHeader("Content-Type"),typeof r.body=="string"){if(!t)throw new Error("Header content type header does not equal body content type.");s=r.body}else{if(t&&t!==r.body.contentType)throw new Error("Header content type header does not equal body content type.");t=r.body.contentType,s=r.body.body}if(Sa(r)&&(e=r.contentDisposition,t=r.contentType,s=r.content),!!s){if(t&&!e&&(e=Aa(t)),!e)throw new Error("Content disposition undefined.");if(!t)throw new Error("Content type undefined.");return{contentDisposition:e,contentType:t,content:s}}}var st;(function(r){r.Initial="Initial",r.Early="Early",r.AckWait="AckWait",r.Confirmed="Confirmed",r.Terminated="Terminated"})(st=st||(st={}));var L;(function(r){r.Initial="Initial",r.HaveLocalOffer="HaveLocalOffer",r.HaveRemoteOffer="HaveRemoteOffer",r.Stable="Stable",r.Closed="Closed"})(L=L||(L={}));const kt=500,V0=4e3,Ta=5e3,$e={T1:kt,T2:V0,TIMER_B:64*kt,TIMER_D:0*kt,TIMER_F:64*kt,TIMER_H:64*kt,TIMER_I:0*Ta,TIMER_J:0*kt,TIMER_K:0*Ta,TIMER_L:64*kt,TIMER_M:64*kt,TIMER_N:64*kt,PROVISIONAL_RESPONSE_INTERVAL:6e4};class Vt extends ar{constructor(e){super(e||"Transaction state error.")}}var z;(function(r){r.ACK="ACK",r.BYE="BYE",r.CANCEL="CANCEL",r.INFO="INFO",r.INVITE="INVITE",r.MESSAGE="MESSAGE",r.NOTIFY="NOTIFY",r.OPTIONS="OPTIONS",r.REGISTER="REGISTER",r.UPDATE="UPDATE",r.SUBSCRIBE="SUBSCRIBE",r.PUBLISH="PUBLISH",r.REFER="REFER",r.PRACK="PRACK"})(z=z||(z={}));const zt=[z.ACK,z.BYE,z.CANCEL,z.INFO,z.INVITE,z.MESSAGE,z.NOTIFY,z.OPTIONS,z.PRACK,z.REFER,z.REGISTER,z.SUBSCRIBE];class Ra{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}}class Mi{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}}class z0{constructor(e,t){this.incomingReferRequest=e,this.session=t}get referTo(){const e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof ze))throw new Error("Failed to parse Refer-To header.");return e}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const e=this.referTo.uri.getHeader("replaces");return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;const t=this.referTo.uri.clone();t.clearHeaders(),e=e||{};const s=(e.extraHeaders||[]).slice(),i=this.replaces;i&&s.push("Replaces: "+decodeURIComponent(i));const n=this.referredBy;return n&&s.push("Referred-By: "+n),e.extraHeaders=s,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}}var B;(function(r){r.Initial="Initial",r.Establishing="Establishing",r.Established="Established",r.Terminating="Terminating",r.Terminated="Terminated"})(B=B||(B={}));class Lr{constructor(e,t={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=B.Initial,this.delegate=t.delegate,this._stateEventEmitter=new jr,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case B.Initial:break;case B.Establishing:break;case B.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case B.Terminating:break;case B.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let t="Session.bye() may only be called if established session.";switch(this.state){case B.Initial:typeof this.cancel=="function"?(t+=" However Inviter.invite() has not yet been called.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called.",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Establishing:typeof this.cancel=="function"?(t+=" However a dialog does not yet exist.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called (or not yet resolved).",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Established:{const s=e.requestDelegate,i=this.copyRequestOptions(e.requestOptions);return this._bye(s,i)}case B.Terminating:t+=" However this session is already terminating.",typeof this.cancel=="function"?t+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(t+=" Perhaps you have already called Session.bye()?");break;case B.Terminated:t+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(t),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==B.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,s=this.copyRequestOptions(e.requestOptions);return this._info(t,s)}invite(e={}){if(this.logger.log("Session.invite"),this.state!==B.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new $i("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);const t={onAccept:n=>{const a=Ur(n.message);if(!a){this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(n,400,"Missing session description"),this.stateTransition(B.Terminated),this.pendingReinvite=!1;return}if(e.withoutSdp){const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(a,o).then(d=>{n.ack({body:d})}).catch(d=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(d.message),this.state===B.Terminated?n.ack():(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}else{const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(a,o).then(()=>{n.ack()}).catch(d=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(d.message),this.state!==B.Terminated?(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated)):n.ack()}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}},onProgress:n=>{},onRedirect:n=>{},onReject:n=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n):this.rollbackOffer().catch(a=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(a.message),this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)})},onTrying:n=>{}},s=e.requestOptions||{};if(s.extraHeaders=(s.extraHeaders||[]).slice(),s.extraHeaders.push("Allow: "+zt.toString()),s.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(t,s))}const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(i).then(n=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return s.body=n,this.dialog.invite(t,s)}).catch(n=>{throw this.logger.error(n.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,n})}message(e={}){if(this.state!==B.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,s=this.copyRequestOptions(e.requestOptions);return this._message(t,s)}refer(e,t={}){if(this.state!==B.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(e instanceof Lr&&!e.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const s=t.requestDelegate,i=this.copyRequestOptions(t.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(t.onNotify,s,i)}_bye(e,t){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const s=this.dialog;switch(s.sessionState){case st.Initial:throw new Error(`Invalid dialog state ${s.sessionState}`);case st.Early:throw new Error(`Invalid dialog state ${s.sessionState}`);case st.AckWait:return this.stateTransition(B.Terminating),new Promise(i=>{s.delegate={onAck:()=>{const n=s.bye(e,t);return this.stateTransition(B.Terminated),i(n),Promise.resolve()},onAckTimeout:()=>{const n=s.bye(e,t);this.stateTransition(B.Terminated),i(n)}}});case st.Confirmed:{const i=s.bye(e,t);return this.stateTransition(B.Terminated),Promise.resolve(i)}case st.Terminated:throw new Error(`Invalid dialog state ${s.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(new Error("Session dialog undefined."))}_message(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(new Error("Session dialog undefined."))}_refer(e,t,s){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,s))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(e,t,s){e.ack();const i=[];t&&i.push("Reason: "+this.getReasonHeaderValue(t,s)),e.session.bye(void 0,{extraHeaders:i})}onAckRequest(e){if(this.logger.log("Session.onAckRequest"),this.state!==B.Established&&this.state!==B.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const t=this.dialog;if(!t)throw new Error("Dialog undefined.");const s={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const i=new j0(e);this.delegate.onAck(i)}switch(this.pendingReinviteAck=!1,t.signalingState){case L.Initial:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case L.Stable:{const i=Ur(e.message);return i?i.contentDisposition==="render"?(this._renderbody=i.content,this._rendertype=i.contentType,Promise.resolve()):i.contentDisposition!=="session"?Promise.resolve():this.setAnswer(i,s).catch(n=>{this.logger.error(n.message);const a=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];t.bye(void 0,{extraHeaders:a}),this.stateTransition(B.Terminated)}):Promise.resolve()}case L.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case L.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case L.Closed:throw new Error(`Invalid signaling state ${t.signalingState}.`);default:throw new Error(`Invalid signaling state ${t.signalingState}.`)}}onByeRequest(e){if(this.logger.log("Session.onByeRequest"),this.state!==B.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){const t=new q0(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(B.Terminated)}onInfoRequest(e){if(this.logger.log("Session.onInfoRequest"),this.state!==B.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){const t=new L0(e);this.delegate.onInfo(t)}else e.accept()}onInviteRequest(e){if(this.logger.log("Session.onInviteRequest"),this.state!==B.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;const t=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){const i=e.message.getHeader("P-Asserted-Identity");if(!i)throw new Error("Header undefined.");this._assertedIdentity=Ie.nameAddrHeaderParse(i)}const s={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(s).then(i=>{const n=e.accept({statusCode:200,extraHeaders:t,body:i});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,200)}).catch(i=>{if(this.logger.error(i.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===L.Stable){const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488);return}this.rollbackOffer().then(()=>{const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488)}).catch(n=>{this.logger.error(n.message),this.logger.error("Failed to rollback offer on re-INVITE request");const a=e.reject({statusCode:488});if(this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,a.message,488)})})}onMessageRequest(e){if(this.logger.log("Session.onMessageRequest"),this.state!==B.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){const t=new Ra(e);this.delegate.onMessage(t)}else e.accept()}onNotifyRequest(e){if(this.logger.log("Session.onNotifyRequest"),this.state!==B.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){const t=new Mi(e);this.onNotify(t);return}if(this.delegate&&this.delegate.onNotify){const t=new Mi(e);this.delegate.onNotify(t)}else e.accept()}onPrackRequest(e){if(this.logger.log("Session.onPrackRequest"),this.state!==B.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw new Error("Unimplemented.")}onReferRequest(e){if(this.logger.log("Session.onReferRequest"),this.state!==B.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!e.message.hasHeader("refer-to")){this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),e.reject();return}const t=new z0(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),t.accept().then(()=>t.makeInviter(this._referralInviterOptions).invite()).catch(s=>{this.logger.error(s.message)}))}generateResponseOfferAnswer(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);const s=Ur(e.message);return!s||s.contentDisposition!=="session"?this.getOffer(t):this.setOfferAndGetAnswer(s,t)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case L.Initial:return this.getOffer(e);case L.HaveLocalOffer:return Promise.resolve(void 0);case L.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case L.Stable:return this.state!==B.Established?Promise.resolve(void 0):this.getOffer(e);case L.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){const t=this.setupSessionDescriptionHandler(),s=e.sessionDescriptionHandlerOptions,i=e.sessionDescriptionHandlerModifiers;try{return t.getDescription(s,i).then(n=>ds(n)).catch(n=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const a=n instanceof Error?n:new Error("Session.getOffer unknown error.");throw this.logger.error(a.message),a})}catch(n){this.logger.error("Session.getOffer: SDH getDescription threw...");const a=n instanceof Error?n:new Error(n);return this.logger.error(a.message),Promise.reject(a)}}rollbackOffer(){const e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(t=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const s=t instanceof Error?t:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(s.message),s})}catch(t){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const s=t instanceof Error?t:new Error(t);return this.logger.error(s.message),Promise.reject(s)}}setAnswer(e,t){const s=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!s.hasDescription(e.contentType))return Promise.reject(new Hi)}catch(a){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return s.setDescription(e.content,i,n).catch(a=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const o=a instanceof Error?a:new Error("Session.setAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setAnswer: SDH setDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setOfferAndGetAnswer(e,t){const s=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!s.hasDescription(e.contentType))return Promise.reject(new Hi)}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return s.setDescription(e.content,i,n).then(()=>s.getDescription(i,n)).then(a=>ds(a)).catch(a=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const o=a instanceof Error?a:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){var e;return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((e=this.delegate)===null||e===void 0)&&e.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case B.Initial:e!==B.Establishing&&e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Establishing:e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Established:e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Terminating:e!==B.Terminated&&t();break;case B.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===B.Terminated&&this.dispose()}copyRequestOptions(e={}){const t=e.extraHeaders?e.extraHeaders.slice():void 0,s=e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0;return{extraHeaders:t,body:s}}getReasonHeaderValue(e,t){const s=e;let i=cs(e);return!i&&t&&(i=t),"SIP;cause="+s+';text="'+i+'"'}referExtraHeaders(e){const t=[];return t.push("Referred-By: <"+this.userAgent.configuration.uri+">"),t.push("Contact: "+this._contact),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),t.push("Refer-To: "+e),t}referToString(e){let t;if(e instanceof yt)t=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");const s=e.remoteIdentity.friendlyName,i=e.dialog.remoteTarget.toString(),n=e.dialog.callId,a=e.dialog.remoteTag,o=e.dialog.localTag,d=encodeURIComponent(`${n};to-tag=${a};from-tag=${o}`);t=`"${s}" <${i}?Replaces=${d}>`}return t}}var ht;(function(r){r.Required="Required",r.Supported="Supported",r.Unsupported="Unsupported"})(ht=ht||(ht={}));const K0={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};class Z0 extends Lr{constructor(e,t){super(e),this.incomingInviteRequest=t,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger("sip.Invitation");const s=this.incomingInviteRequest.message,i=s.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(this.rel100="required");const n=s.getHeader("supported");if(n&&n.toLowerCase().includes("100rel")&&(this.rel100="supported"),s.toTag=t.toTag,typeof s.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{t.reject({statusCode:480}),this.stateTransition(B.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),s.hasHeader("expires")){const d=Number(s.getHeader("expires")||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===B.Initial&&(t.reject({statusCode:487}),this.stateTransition(B.Terminated))},d)}const a=this.request.getHeader("P-Asserted-Identity");a&&(this._assertedIdentity=Ie.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();const o=s.parseHeader("Content-Disposition");o&&o.type==="render"&&(this._renderbody=s.body,this._rendertype=s.getHeader("Content-Type")),this._id=s.callId+s.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case B.Initial:return this.reject().then(()=>super.dispose());case B.Establishing:return this.reject().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log("Invitation.accept"),this.state!==B.Initial){const t=new Error(`Invalid session state ${this.state}`);return this.logger.error(t.message),Promise.reject(t)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(B.Establishing),this.sendAccept(e).then(({message:t,session:s})=>{s.delegate={onAck:i=>this.onAckRequest(i),onAckTimeout:()=>this.onAckTimeout(),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=s,this.stateTransition(B.Established),this._replacee&&this._replacee._bye()}).catch(t=>this.handleResponseError(t))}progress(e={}){if(this.logger.log("Invitation.progress"),this.state!==B.Initial){const s=new Error(`Invalid session state ${this.state}`);return this.logger.error(s.message),Promise.reject(s)}const t=e.statusCode||180;if(t<100||t>199)throw new TypeError("Invalid statusCode: "+t);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(s=>this.handleResponseError(s)):this.rel100!=="required"&&!(this.rel100==="supported"&&e.rel100)&&!(this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===ht.Required)?this.sendProgress(e).then(()=>{}).catch(s=>this.handleResponseError(s)):this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(s=>this.handleResponseError(s))}reject(e={}){if(this.logger.log("Invitation.reject"),this.state!==B.Initial&&this.state!==B.Establishing){const a=new Error(`Invalid session state ${this.state}`);return this.logger.error(a.message),Promise.reject(a)}const t=e.statusCode||480,s=e.reasonPhrase?e.reasonPhrase:cs(t),i=e.extraHeaders||[];if(t<300||t>699)throw new TypeError("Invalid statusCode: "+t);const n=e.body?ds(e.body):void 0;return t<400?this.incomingInviteRequest.redirect([],{statusCode:t,reasonPhrase:s,extraHeaders:i,body:n}):this.incomingInviteRequest.reject({statusCode:t,reasonPhrase:s,extraHeaders:i,body:n}),this.stateTransition(B.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log("Invitation._onCancel"),this.state!==B.Initial&&this.state!==B.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){const t=new U0(e);this.delegate.onCancel(t)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(B.Terminated)}handlePrackOfferAnswer(e){if(!this.dialog)throw new Error("Dialog undefined.");const t=Ur(e.message);if(!t||t.contentDisposition!=="session")return Promise.resolve(void 0);const s={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case L.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case L.Stable:return this.setAnswer(t,s).then(()=>{});case L.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case L.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,s);case L.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof Hi?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),t=415):e instanceof M0?this.logger.error("A session description handler occurred while sending response"):e instanceof Ni?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof Vt&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===B.Initial||this.state===B.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(B.Terminated)}catch(s){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),s}if(this.isCanceled){this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.");return}throw e}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(B.Terminated)}sendAccept(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},s=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,t)).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:s})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:s})))}sendProgress(e={}){const t=e.statusCode||180,s=e.reasonPhrase,i=(e.extraHeaders||[]).slice(),n=e.body?ds(e.body):void 0;if(t===183&&!n)return this.sendProgressWithSDP(e);try{const a=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:s,extraHeaders:i,body:n});return this._dialog=a.session,Promise.resolve(a)}catch(a){return Promise.reject(a)}}sendProgressWithSDP(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},s=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(a=>this.incomingInviteRequest.progress({statusCode:s,reasonPhrase:i,extraHeaders:n,body:a})).then(a=>(this._dialog=a.session,a))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},s=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();n.push("Require: 100rel"),n.push("RSeq: "+this.rseq++);let a;return new Promise((o,d)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(c=>(a=c,this.incomingInviteRequest.progress({statusCode:s,reasonPhrase:i,extraHeaders:n,body:a}))).then(c=>{this._dialog=c.session;let l,g;c.session.delegate={onPrack:x=>{l=x,clearTimeout(y),clearTimeout(C),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(l).then(p=>{try{g=l.accept({statusCode:200,body:p}),this.prackArrived(),o({prackRequest:l,prackResponse:g,progressResponse:c})}catch(E){d(E)}}).catch(p=>d(p)))}};const y=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(C),this.reject({statusCode:504}).then(()=>d(new Ni)).catch(x=>d(x)))},$e.T1*64),w=()=>{try{this.incomingInviteRequest.progress({statusCode:s,reasonPhrase:i,extraHeaders:n,body:a})}catch(x){this.waitingForPrack=!1,d(x);return}C=setTimeout(w,b*=2)};let b=$e.T1,C=setTimeout(w,b)}).catch(c=>{this.waitingForPrack=!1,d(c)})})}sendProgressTrying(){try{const e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((e,t)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=t}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new Ni),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}}class Fa extends Lr{constructor(e,t,s={}){super(e,s),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger("sip.Inviter"),this.earlyMedia=s.earlyMedia!==void 0?s.earlyMedia:this.earlyMedia,this.fromTag=ls(),this.inviteWithoutSdp=s.inviteWithoutSdp!==void 0?s.inviteWithoutSdp:this.inviteWithoutSdp;const i=Object.assign({},s);i.params=Object.assign({},s.params);const n=s.anonymous||!1,a=e.contact.toString({anonymous:n,outbound:n?!e.contact.tempGruu:!e.contact.pubGruu});n&&e.configuration.uri&&(i.params.fromDisplayName="Anonymous",i.params.fromUri="sip:anonymous@anonymous.invalid");let o=e.userAgentCore.configuration.aor;if(i.params.fromUri&&(o=typeof i.params.fromUri=="string"?Ie.URIParse(i.params.fromUri):i.params.fromUri),!o)throw new TypeError("Invalid from URI: "+i.params.fromUri);let d=t;if(i.params.toUri&&(d=typeof i.params.toUri=="string"?Ie.URIParse(i.params.toUri):i.params.toUri),!d)throw new TypeError("Invalid to URI: "+i.params.toUri);const c=Object.assign({},i.params);c.fromTag=this.fromTag;const l=(i.extraHeaders||[]).slice();n&&e.configuration.uri&&(l.push("P-Preferred-Identity: "+e.configuration.uri.toString()),l.push("Privacy: id")),l.push("Contact: "+a),l.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),e.configuration.sipExtension100rel===ht.Required&&l.push("Require: 100rel"),e.configuration.sipExtensionReplaces===ht.Required&&l.push("Require: replaces"),i.extraHeaders=l;const g=void 0;this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(z.INVITE,t,o,d,c,l,g),this._contact=a,this._referralInviterOptions=i,this._renderbody=s.renderbody,this._rendertype=s.rendertype,s.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=s.sessionDescriptionHandlerModifiers),s.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=s.sessionDescriptionHandlerOptions),s.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=s.sessionDescriptionHandlerModifiersReInvite),s.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=s.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case B.Initial:return this.cancel().then(()=>super.dispose());case B.Establishing:return this.cancel().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log("Inviter.cancel"),this.state!==B.Initial&&this.state!==B.Establishing){const s=new Error(`Invalid session state ${this.state}`);return this.logger.error(s.message),Promise.reject(s)}this.isCanceled=!0,this.stateTransition(B.Terminating);function t(s,i){if(s&&s<200||s>699)throw new TypeError("Invalid statusCode: "+s);if(s){const n=s,a=cs(s)||i;return"SIP;cause="+n+';text="'+a+'"'}}if(this.outgoingInviteRequest){let s;e.statusCode&&e.reasonPhrase&&(s=t(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(s,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(B.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log("Inviter.invite"),this.state!==B.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(B.Establishing),Promise.resolve(this.sendInvite(e));const t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(t).then(s=>(this.outgoingRequestMessage.body={body:s.content,contentType:s.contentType},this.stateTransition(B.Establishing),this.sendInvite(e))).catch(s=>{throw this.logger.log(s.message),this.state!==B.Terminated&&this.stateTransition(B.Terminated),s})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:t=>{if(this.dialog){this.logger.log("Additional confirmed dialog, sending ACK and BYE"),this.ackAndBye(t);return}if(this.isCanceled){this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(t),this.stateTransition(B.Terminated);return}this.notifyReferer(t),this.onAccept(t).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})},onProgress:t=>{this.isCanceled||(this.notifyReferer(t),this.onProgress(t).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)}))},onRedirect:t=>{this.notifyReferer(t),this.onRedirect(t),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t)},onReject:t=>{this.notifyReferer(t),this.onReject(t),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)},onTrying:t=>{this.notifyReferer(t),this.onTrying(t),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Lr))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");const t=e.message.statusCode,s=e.message.reasonPhrase,i=`SIP/2.0 ${t} ${s}`.trim(),n=this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:i}});n.delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log("Inviter.onAccept"),this.state!==B.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.message,s=e.session;switch(t.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Ie.nameAddrHeaderParse(t.getHeader("P-Asserted-Identity"))),s.delegate={onAck:i=>this.onAckRequest(i),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=s,s.signalingState){case L.Initial:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case L.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case L.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,i).then(n=>{e.ack({body:n}),this.stateTransition(B.Established)}).catch(n=>{throw this.ackAndBye(e,488,"Invalid session description"),this.stateTransition(B.Terminated),n})}case L.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const a=this.earlyMediaSessionDescriptionHandlers.get(s.id);if(!a)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(a),this.earlyMediaSessionDescriptionHandlers.delete(s.id),e.ack(),this.stateTransition(B.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==s){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const a=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),Promise.reject(a)}return e.ack(),this.stateTransition(B.Established),Promise.resolve()}const i=s.answer;if(!i)throw new Error("Answer is undefined.");const n={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(i,n).then(()=>{let a;this._renderbody&&this._rendertype&&(a={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),e.ack(a),this.stateTransition(B.Established)}).catch(a=>{throw this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),a})}case L.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(e){var t;if(this.logger.log("Inviter.onProgress"),this.state!==B.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const s=e.message,i=e.session;s.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Ie.nameAddrHeaderParse(s.getHeader("P-Asserted-Identity")));const n=s.getHeader("require"),a=s.getHeader("rseq"),d=!!(n&&n.includes("100rel")&&a?Number(a):void 0),c=[];switch(d&&c.push("RAck: "+s.getHeader("rseq")+" "+s.getHeader("cseq")),i.signalingState){case L.Initial:return d&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:c})),Promise.resolve();case L.HaveLocalOffer:return d&&e.prack({extraHeaders:c}),Promise.resolve();case L.HaveRemoteOffer:if(!d)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const l=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((t=this.delegate)===null||t===void 0)&&t.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(l,!0),this.earlyMediaSessionDescriptionHandlers.set(i.id,l),l.setDescription(s.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>l.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(g=>{const u={contentDisposition:"session",contentType:g.contentType,content:g.body};e.prack({extraHeaders:c,body:u})}).catch(g=>{throw this.stateTransition(B.Terminated),g})}case L.Stable:if(d&&e.prack({extraHeaders:c}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=i;const l=i.answer;if(!l)throw new Error("Answer is undefined.");const g={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(l,g).catch(u=>{throw this.stateTransition(B.Terminated),u})}return Promise.resolve();case L.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(e){if(this.logger.log("Inviter.onRedirect"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onReject(e){if(this.logger.log("Inviter.onReject"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onTrying(e){if(this.logger.log("Inviter.onTrying"),this.state!==B.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}}var me;(function(r){r.Initial="Initial",r.Registered="Registered",r.Unregistered="Unregistered",r.Terminated="Terminated"})(me=me||(me={}));class Et{constructor(e,t={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=me.Initial,this._waiting=!1,this._stateEventEmitter=new jr,this._waitingEventEmitter=new jr,this.userAgent=e;const s=e.configuration.uri.clone();if(s.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},Et.defaultOptions()),{registrar:s}),Et.stripUndefinedProperties(t)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&Ie.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const i=this.options.registrar,n=this.options.params&&this.options.params.fromUri||e.userAgentCore.configuration.aor,a=this.options.params&&this.options.params.toUri||e.configuration.uri,o=this.options.params||{},d=(t.extraHeaders||[]).slice();if(this.request=e.userAgentCore.makeOutgoingRequestMessage(z.REGISTER,i,n,a,o,d,void 0),this.expires=this.options.expires||Et.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||Et.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=e.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(c=>{const l=this.options[c];switch(c){case"registrar":this.logger.log("· "+c+": "+l);break;default:this.logger.log("· "+c+": "+JSON.stringify(l))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:Et.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new yt("sip","anonymous","anonymous.invalid"),refreshFrequency:Et.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,s)=>(e[s]!==void 0&&(t[s]=e[s]),t),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{const t=()=>{if(!this.waiting&&this._state===me.Registered){this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),this.unregister();return}this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{t()},{once:!0}):t()}))}register(e={}){if(this.state===me.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new $i("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));const t=(this.options.extraHeaders||[]).slice();t.push("Contact: "+this.generateContactHeader(this.expires)),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=t,this.waitingToggle(!0);const s=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{let n;i.message.hasHeader("expires")&&(n=Number(i.message.getHeader("expires"))),this._contacts=i.message.getHeaders("contact");let a=this._contacts.length;if(!a){this.logger.error("No Contact header in response to REGISTER, dropping response."),this.unregistered();return}let o;for(;a--;){if(o=i.message.parseHeader("contact",a),!o)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&_a(o.uri,this.userAgent.contact.pubGruu)){n=Number(o.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(o.uri.user===this.userAgent.contact.uri.user){n=Number(o.getParam("expires"));break}}else if(_a(o.uri,this.userAgent.contact.uri)){n=Number(o.getParam("expires"));break}o=void 0}if(o===void 0){this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(n===void 0){this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(o.hasParam("temp-gruu")){const d=o.getParam("temp-gruu");d&&(this.userAgent.contact.tempGruu=Ie.URIParse(d.replace(/"/g,"")))}if(o.hasParam("pub-gruu")){const d=o.getParam("pub-gruu");d&&(this.userAgent.contact.pubGruu=Ie.URIParse(d.replace(/"/g,"")))}this.registered(n),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{if(i.message.statusCode===423){if(!i.message.hasHeader("min-expires")){this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(i.message.getHeader("min-expires")),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${i.message.statusCode}`);let n=NaN;if(i.message.statusCode===500||i.message.statusCode===503){const a=i.message.getHeader("retry-after");a&&(n=Number.parseInt(a,void 0))}this._retryAfter=isNaN(n)?void 0:n,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(s)}unregister(e={}){if(this.state===me.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==me.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new $i("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}this._state!==me.Registered&&!e.all&&this.logger.warn("Not currently registered, but sending an unregister anyway.");const t=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=t,e.all?(t.push("Contact: *"),t.push("Expires: 0")):t.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const s=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{this._contacts=i.message.getHeaders("contact"),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{this.logger.error(`Unregister rejected with status code ${i.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(s)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let t=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(t+=";reg-id="+this.options.regId,t+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(s=>{t+=";"+s}),t+=";expires="+e,t}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},e*1e3),this._state!==me.Registered&&this.stateTransition(me.Registered)}unregistered(){this.clearTimers(),this._state!==me.Unregistered&&this.stateTransition(me.Unregistered)}terminated(){this.clearTimers(),this._state!==me.Terminated&&this.stateTransition(me.Terminated)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case me.Initial:e!==me.Registered&&e!==me.Unregistered&&e!==me.Terminated&&t();break;case me.Registered:e!==me.Unregistered&&e!==me.Terminated&&t();break;case me.Unregistered:e!==me.Registered&&e!==me.Terminated&&t();break;case me.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===me.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw new Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let e="An attempt was made to send a REGISTER request while a prior one was still in progress.";e+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",e+=" from the registrar for the previous one or the previous REGISTER request has timed out.",e+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",e+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn(e)}stateError(){let t=`An attempt was made to send a REGISTER request when the Registerer ${this.state===me.Terminated?"is in 'Terminated' state":"has been disposed"}.`;t+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",t+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(t)}}Et.defaultExpires=600,Et.defaultRefreshFrequency=99;var fe;(function(r){r.Initial="Initial",r.NotifyWait="NotifyWait",r.Pending="Pending",r.Active="Active",r.Terminated="Terminated"})(fe=fe||(fe={}));var ee;(function(r){r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Disconnected="Disconnected"})(ee=ee||(ee={}));var Me;(function(r){r.Started="Started",r.Stopped="Stopped"})(Me=Me||(Me={}));class Fe{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){const t=Fe.hexChars,s=Fe.hexOut;let i,n,a,o;for(o=0;o<4;o+=1)for(n=o*8,i=e[o],a=0;a<8;a+=2)s[n+1+a]=t.charAt(i&15),i>>>=4,s[n+0+a]=t.charAt(i&15),i>>>=4;return s.join("")}static _md5cycle(e,t){let s=e[0],i=e[1],n=e[2],a=e[3];s+=(i&n|~i&a)+t[0]-680876936|0,s=(s<<7|s>>>25)+i|0,a+=(s&i|~s&n)+t[1]-389564586|0,a=(a<<12|a>>>20)+s|0,n+=(a&s|~a&i)+t[2]+606105819|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&s)+t[3]-1044525330|0,i=(i<<22|i>>>10)+n|0,s+=(i&n|~i&a)+t[4]-176418897|0,s=(s<<7|s>>>25)+i|0,a+=(s&i|~s&n)+t[5]+1200080426|0,a=(a<<12|a>>>20)+s|0,n+=(a&s|~a&i)+t[6]-1473231341|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&s)+t[7]-45705983|0,i=(i<<22|i>>>10)+n|0,s+=(i&n|~i&a)+t[8]+1770035416|0,s=(s<<7|s>>>25)+i|0,a+=(s&i|~s&n)+t[9]-1958414417|0,a=(a<<12|a>>>20)+s|0,n+=(a&s|~a&i)+t[10]-42063|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&s)+t[11]-1990404162|0,i=(i<<22|i>>>10)+n|0,s+=(i&n|~i&a)+t[12]+1804603682|0,s=(s<<7|s>>>25)+i|0,a+=(s&i|~s&n)+t[13]-40341101|0,a=(a<<12|a>>>20)+s|0,n+=(a&s|~a&i)+t[14]-1502002290|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&s)+t[15]+1236535329|0,i=(i<<22|i>>>10)+n|0,s+=(i&a|n&~a)+t[1]-165796510|0,s=(s<<5|s>>>27)+i|0,a+=(s&n|i&~n)+t[6]-1069501632|0,a=(a<<9|a>>>23)+s|0,n+=(a&i|s&~i)+t[11]+643717713|0,n=(n<<14|n>>>18)+a|0,i+=(n&s|a&~s)+t[0]-373897302|0,i=(i<<20|i>>>12)+n|0,s+=(i&a|n&~a)+t[5]-701558691|0,s=(s<<5|s>>>27)+i|0,a+=(s&n|i&~n)+t[10]+38016083|0,a=(a<<9|a>>>23)+s|0,n+=(a&i|s&~i)+t[15]-660478335|0,n=(n<<14|n>>>18)+a|0,i+=(n&s|a&~s)+t[4]-405537848|0,i=(i<<20|i>>>12)+n|0,s+=(i&a|n&~a)+t[9]+568446438|0,s=(s<<5|s>>>27)+i|0,a+=(s&n|i&~n)+t[14]-1019803690|0,a=(a<<9|a>>>23)+s|0,n+=(a&i|s&~i)+t[3]-187363961|0,n=(n<<14|n>>>18)+a|0,i+=(n&s|a&~s)+t[8]+1163531501|0,i=(i<<20|i>>>12)+n|0,s+=(i&a|n&~a)+t[13]-1444681467|0,s=(s<<5|s>>>27)+i|0,a+=(s&n|i&~n)+t[2]-51403784|0,a=(a<<9|a>>>23)+s|0,n+=(a&i|s&~i)+t[7]+1735328473|0,n=(n<<14|n>>>18)+a|0,i+=(n&s|a&~s)+t[12]-1926607734|0,i=(i<<20|i>>>12)+n|0,s+=(i^n^a)+t[5]-378558|0,s=(s<<4|s>>>28)+i|0,a+=(s^i^n)+t[8]-2022574463|0,a=(a<<11|a>>>21)+s|0,n+=(a^s^i)+t[11]+1839030562|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^s)+t[14]-35309556|0,i=(i<<23|i>>>9)+n|0,s+=(i^n^a)+t[1]-1530992060|0,s=(s<<4|s>>>28)+i|0,a+=(s^i^n)+t[4]+1272893353|0,a=(a<<11|a>>>21)+s|0,n+=(a^s^i)+t[7]-155497632|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^s)+t[10]-1094730640|0,i=(i<<23|i>>>9)+n|0,s+=(i^n^a)+t[13]+681279174|0,s=(s<<4|s>>>28)+i|0,a+=(s^i^n)+t[0]-358537222|0,a=(a<<11|a>>>21)+s|0,n+=(a^s^i)+t[3]-722521979|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^s)+t[6]+76029189|0,i=(i<<23|i>>>9)+n|0,s+=(i^n^a)+t[9]-640364487|0,s=(s<<4|s>>>28)+i|0,a+=(s^i^n)+t[12]-421815835|0,a=(a<<11|a>>>21)+s|0,n+=(a^s^i)+t[15]+530742520|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^s)+t[2]-995338651|0,i=(i<<23|i>>>9)+n|0,s+=(n^(i|~a))+t[0]-198630844|0,s=(s<<6|s>>>26)+i|0,a+=(i^(s|~n))+t[7]+1126891415|0,a=(a<<10|a>>>22)+s|0,n+=(s^(a|~i))+t[14]-1416354905|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~s))+t[5]-57434055|0,i=(i<<21|i>>>11)+n|0,s+=(n^(i|~a))+t[12]+1700485571|0,s=(s<<6|s>>>26)+i|0,a+=(i^(s|~n))+t[3]-1894986606|0,a=(a<<10|a>>>22)+s|0,n+=(s^(a|~i))+t[10]-1051523|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~s))+t[1]-2054922799|0,i=(i<<21|i>>>11)+n|0,s+=(n^(i|~a))+t[8]+1873313359|0,s=(s<<6|s>>>26)+i|0,a+=(i^(s|~n))+t[15]-30611744|0,a=(a<<10|a>>>22)+s|0,n+=(s^(a|~i))+t[6]-1560198380|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~s))+t[13]+1309151649|0,i=(i<<21|i>>>11)+n|0,s+=(n^(i|~a))+t[4]-145523070|0,s=(s<<6|s>>>26)+i|0,a+=(i^(s|~n))+t[11]-1120210379|0,a=(a<<10|a>>>22)+s|0,n+=(s^(a|~i))+t[2]+718787259|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~s))+t[9]-343485551|0,i=(i<<21|i>>>11)+n|0,e[0]=s+e[0]|0,e[1]=i+e[1]|0,e[2]=n+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(Fe.stateIdentity),this}appendStr(e){const t=this._buffer8,s=this._buffer32;let i=this._bufferLength,n,a;for(a=0;a<e.length;a+=1){if(n=e.charCodeAt(a),n<128)t[i++]=n;else if(n<2048)t[i++]=(n>>>6)+192,t[i++]=n&63|128;else if(n<55296||n>56319)t[i++]=(n>>>12)+224,t[i++]=n>>>6&63|128,t[i++]=n&63|128;else{if(n=(n-55296)*1024+(e.charCodeAt(++a)-56320)+65536,n>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(n>>>18)+240,t[i++]=n>>>12&63|128,t[i++]=n>>>6&63|128,t[i++]=n&63|128}i>=64&&(this._dataLength+=64,Fe._md5cycle(this._state,s),i-=64,s[0]=s[16])}return this._bufferLength=i,this}appendAsciiStr(e){const t=this._buffer8,s=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e.charCodeAt(a++);if(i<64)break;this._dataLength+=64,Fe._md5cycle(this._state,s),i=0}return this._bufferLength=i,this}appendByteArray(e){const t=this._buffer8,s=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e[a++];if(i<64)break;this._dataLength+=64,Fe._md5cycle(this._state,s),i=0}return this._bufferLength=i,this}getState(){const e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){const t=e.buffer,s=e.state,i=this._state;let n;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],n=0;n<t.length;n+=1)this._buffer8[n]=t.charCodeAt(n)}end(e=!1){const t=this._bufferLength,s=this._buffer8,i=this._buffer32,n=(t>>2)+1;let a;if(this._dataLength+=t,s[t]=128,s[t+1]=s[t+2]=s[t+3]=0,i.set(Fe.buffer32Identity.subarray(n),n),t>55&&(Fe._md5cycle(this._state,i),i.set(Fe.buffer32Identity)),a=this._dataLength*8,a<=4294967295)i[14]=a;else{const o=a.toString(16).match(/(.*?)(.{0,8})$/);if(o===null)return;const d=parseInt(o[2],16),c=parseInt(o[1],16)||0;i[14]=d,i[15]=c}return Fe._md5cycle(this._state,i),e?this._state:Fe._hex(this._state)}}Fe.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),Fe.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Fe.hexChars="0123456789abcdef",Fe.hexOut=[],Fe.onePassHasher=new Fe,Fe.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");function Kt(r){return Fe.hashStr(r)}class X0{constructor(e,t,s,i){this.logger=e.getLogger("sipjs.digestauthentication"),this.username=s,this.password=i,this.ha1=t,this.nc=0,this.ncHex="00000000"}authenticate(e,t,s){if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else if(t.qop.indexOf("auth-int")>-1)this.qop="auth-int";else return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=or(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(s),!0}toString(){const e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}updateNcHex(){const e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e}calculateResponse(e){let t,s;t=this.ha1,(t===""||t===void 0)&&(t=Kt(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(s=Kt(this.method+":"+this.uri),this.response=Kt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+s)):this.qop==="auth-int"?(s=Kt(this.method+":"+this.uri+":"+Kt(e||"")),this.response=Kt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+s)):this.qop===void 0&&(s=Kt(this.method+":"+this.uri),this.response=Kt(t+":"+this.nonce+":"+s))}}var Ne;(function(r){r[r.error=0]="error",r[r.warn=1]="warn",r[r.log=2]="log",r[r.debug=3]="debug"})(Ne=Ne||(Ne={}));class ka{constructor(e,t,s){this.logger=e,this.category=t,this.label=s}error(e){this.genericLog(Ne.error,e)}warn(e){this.genericLog(Ne.warn,e)}log(e){this.genericLog(Ne.log,e)}debug(e){this.genericLog(Ne.debug,e)}genericLog(e,t){this.logger.genericLog(e,this.category,this.label,t)}get level(){return this.logger.level}set level(e){this.logger.level=e}}class J0{constructor(){this.builtinEnabled=!0,this._level=Ne.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:Ne.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e=="function"?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0}getLogger(e,t){if(t&&this.level===3)return new ka(this,e,t);if(this.loggers[e])return this.loggers[e];{const s=new ka(this,e);return this.loggers[e]=s,s}}genericLog(e,t,s,i){this.level>=e&&this.builtinEnabled&&this.print(e,t,s,i),this.connector&&this.connector(Ne[e],t,s,i)}print(e,t,s,i){if(typeof i=="string"){const n=[new Date,t];s&&n.push(s),i=n.concat(i).join(" | ")}switch(e){case Ne.error:console.error(i);break;case Ne.warn:console.warn(i);break;case Ne.log:console.log(i);break;case Ne.debug:console.debug(i);break}}}var hs;(function(r){function e(i,n){let a=n,o=0,d=0;if(i.substring(a,a+2).match(/(^\r\n)/))return-2;for(;o===0;){if(d=i.indexOf(`\r
|
|
179
|
-
`,a),d===-1)return d;!i.substring(d+2,d+4).match(/(^\r\n)/)&&i.charAt(d+2).match(/(^\s+)/)?a=d+2:o=d}return o}r.getHeader=e;function t(i,n,a,o){const d=n.indexOf(":",a),c=n.substring(a,d).trim(),l=n.substring(d+1,o).trim();let g;switch(c.toLowerCase()){case"via":case"v":i.addHeader("via",l),i.getHeaders("via").length===1?(g=i.parseHeader("Via"),g&&(i.via=g,i.viaBranch=g.branch)):g=0;break;case"from":case"f":i.setHeader("from",l),g=i.parseHeader("from"),g&&(i.from=g,i.fromTag=g.getParam("tag"));break;case"to":case"t":i.setHeader("to",l),g=i.parseHeader("to"),g&&(i.to=g,i.toTag=g.getParam("tag"));break;case"record-route":if(g=Ie.parse(l,"Record_Route"),g===-1){g=void 0;break}if(!(g instanceof Array)){g=void 0;break}g.forEach(
|
|
180
|
-
`);if(o===-1){n.warn("no CRLF found, not a SIP message, discarded");return}const d=i.substring(0,o),c=Ie.parse(d,"Request_Response");let l;if(c===-1){n.warn('error parsing first line of SIP message: "'+d+'"');return}else c.status_code?(l=new Gt,l.statusCode=c.status_code,l.reasonPhrase=c.reason_phrase):(l=new wr,l.method=c.method,l.ruri=c.uri);l.data=i,a=o+2;let g;for(;;){if(o=e(i,a),o===-2){g=a+2;break}else if(o===-1){n.error("malformed message");return}const
|
|
181
|
-
`;if(e.statusCode<100||e.statusCode>699)throw new TypeError("Invalid statusCode: "+e.statusCode);const s=e.reasonPhrase?e.reasonPhrase:cs(e.statusCode);let i="SIP/2.0 "+e.statusCode+" "+s+t;e.statusCode>=100&&e.statusCode<200,e.statusCode;const n="From: "+r.getHeader("From")+t,a="Call-ID: "+r.callId+t,o="CSeq: "+r.cseq+" "+r.method+t,d=r.getHeaders("via").reduce((y,w)=>y+"Via: "+w+t,"");let c="To: "+r.getHeader("to");if(e.statusCode>100&&!r.parseHeader("to").hasParam("tag")){let y=e.toTag;y||(y=ls()),c+=";tag="+y}c+=t;let l="";e.supported&&(l="Supported: "+e.supported.join(", ")+t);let g="";e.userAgent&&(g="User-Agent: "+e.userAgent+t);let u="";return e.extraHeaders&&(u=e.extraHeaders.reduce((y,w)=>y+w.trim()+t,"")),i+=d,i+=n,i+=c,i+=o,i+=a,i+=l,i+=g,i+=u,e.body?(i+="Content-Type: "+e.body.contentType+t,i+="Content-Length: "+qr(e.body.content)+t+t,i+=e.body.content):i+="Content-Length: 0"+t+t,{message:i}}class ji extends ar{constructor(e){super(e||"Unspecified transport error.")}}class Ia{constructor(e,t,s,i,n){this._transport=e,this._user=t,this._id=s,this._state=i,this.listeners=new Array,this.logger=t.loggerFactory.getLogger(n,s),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,t){const s=()=>{this.removeStateChangeListener(s),e()};(t==null?void 0:t.once)===!0?this.listeners.push(s):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}logTransportError(e,t){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(t)}send(e){return this.transport.send(e).catch(t=>{if(t instanceof ji)throw this.onTransportError(t),t;let s;throw t&&typeof t.message=="string"?s=new ji(t.message):s=new ji,this.onTransportError(s),s})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}}class Pa extends Ia{constructor(e,t,s,i,n){super(t,s,e.viaBranch,i,n),this._request=e,this.user=s}get request(){return this._request}}var k;(function(r){r.Accepted="Accepted",r.Calling="Calling",r.Completed="Completed",r.Confirmed="Confirmed",r.Proceeding="Proceeding",r.Terminated="Terminated",r.Trying="Trying"})(k=k||(k={}));class Ke extends Pa{constructor(e,t,s){super(e,t,s,k.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(e){switch(this.state){case k.Proceeding:if(e.method===z.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(s=>{this.logTransportError(s,"Failed to send retransmission of provisional response.")});return}break;case k.Accepted:if(e.method===z.INVITE)return;break;case k.Completed:if(e.method===z.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");this.send(this.lastFinalResponse).catch(s=>{this.logTransportError(s,"Failed to send retransmission of final response.")});return}if(e.method===z.ACK){this.stateTransition(k.Confirmed);return}break;case k.Confirmed:if(e.method===z.INVITE||e.method===z.ACK)return;break;case k.Terminated:if(e.method===z.INVITE||e.method===z.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const t=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(t)}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);switch(this.state){case k.Proceeding:if(e>=100&&e<=199){this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 1xx response.")});return}if(e>=200&&e<=299){this.lastFinalResponse=t,this.stateTransition(k.Accepted),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}if(e>=300&&e<=699){this.lastFinalResponse=t,this.stateTransition(k.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send non-2xx final response.")});return}break;case k.Accepted:if(e>=200&&e<=299){this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}break;case k.Completed:break;case k.Confirmed:break;case k.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const s=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(s),new Error(s)}retransmitAcceptedResponse(){this.state===k.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return"INVITE server transaction"}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case k.Proceeding:t();break;case k.Accepted:case k.Completed:this.state!==k.Proceeding&&t();break;case k.Confirmed:this.state!==k.Completed&&t();break;case k.Terminated:this.state!==k.Accepted&&this.state!==k.Completed&&this.state!==k.Confirmed&&t();break;default:t()}this.stopProgressExtensionTimer(),e===k.Accepted&&(this.L=setTimeout(()=>this.timerL(),$e.TIMER_L)),e===k.Completed&&(this.H=setTimeout(()=>this.timerH(),$e.TIMER_H)),e===k.Confirmed&&(this.I=setTimeout(()=>this.timerI(),$e.TIMER_I)),e===k.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")})},$e.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===k.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(k.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(k.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===k.Accepted&&this.stateTransition(k.Terminated)}}class us extends Ia{constructor(e,t,s,i,n){super(t,s,us.makeId(e),i,n),this._request=e,this.user=s,e.setViaHeader(this.id,t.protocol)}static makeId(e){if(e.method==="CANCEL"){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}else return"z9hG4bK"+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}}class Qe extends us{constructor(e,t,s){super(e,t,s,k.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),$e.TIMER_F),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case k.Trying:if(t>=100&&t<=199){this.stateTransition(k.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=699){if(this.stateTransition(k.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case k.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699){if(this.stateTransition(k.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case k.Completed:return;case k.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const s=`Non-INVITE client transaction received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(s)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(k.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(e,t=!1){const s=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case k.Trying:s();break;case k.Proceeding:this.state!==k.Trying&&s();break;case k.Completed:this.state!==k.Trying&&this.state!==k.Proceeding&&s();break;case k.Terminated:this.state!==k.Trying&&this.state!==k.Proceeding&&this.state!==k.Completed&&(t||s());break;default:s()}e===k.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),$e.TIMER_K)),e===k.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===k.Trying||this.state===k.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(k.Terminated))}timerK(){this.state===k.Completed&&this.stateTransition(k.Terminated)}}class Er{constructor(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,t){const i=t.getHeaders("record-route").reverse(),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof ze))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,d=void 0,c=e.callId,l=e.fromTag,g=t.toTag;if(!c)throw new Error("Call id undefined.");if(!l)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,y=e.to.uri;if(!t.statusCode)throw new Error("Incoming response status code undefined.");const w=t.statusCode<200;return{id:c+l+g,early:w,callId:c,localTag:l,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:d,localURI:u,remoteURI:y,remoteTarget:a,routeSet:i,secure:!1}}static initialDialogStateForUserAgentServer(e,t,s=!1){const n=e.getHeaders("record-route"),a=e.parseHeader("contact");if(!a)throw new Error("Contact undefined.");if(!(a instanceof ze))throw new Error("Contact not instance of NameAddrHeader.");const o=a.uri,d=e.cseq,c=void 0,l=e.callId,g=t,u=e.fromTag,y=e.from.uri,w=e.to.uri;return{id:l+g+u,early:s,callId:l,localTag:g,remoteTag:u,localSequenceNumber:c,remoteSequenceNumber:d,localURI:w,remoteURI:y,remoteTarget:o,routeSet:n,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==z.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()}createOutgoingRequestMessage(e,t){const s=this.remoteURI,i=this.remoteTag,n=this.localURI,a=this.localTag,o=this.callId;let d;t&&t.cseq?d=t.cseq:this.dialogState.localSequenceNumber?d=this.dialogState.localSequenceNumber+=1:d=this.dialogState.localSequenceNumber=1;const c=this.remoteTarget,l=this.routeSet,g=t&&t.extraHeaders,u=t&&t.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,n,s,{callId:o,cseq:d,fromTag:a,toTag:i,routeSet:l},g,u)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===z.ACK?!0:this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(e,{statusCode:500}),!1):!0}}class Zt extends us{constructor(e,t,s){super(e,t,s,k.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),$e.TIMER_B),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(e){const t=e.toTag;if(!t)throw new Error("To tag undefined.");const s="z9hG4bK"+Math.floor(Math.random()*1e7);e.setViaHeader(s,this.transport.protocol),this.ackRetransmissionCache.set(t,e),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send ACK to 2xx response.")})}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case k.Calling:if(t>=100&&t<=199){this.stateTransition(k.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(k.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(k.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case k.Proceeding:if(t>=100&&t<=199){this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(k.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(k.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case k.Accepted:if(t>=200&&t<=299){if(!this.ackRetransmissionCache.has(e.toTag)){this.ackRetransmissionCache.set(e.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(e);return}const i=this.ackRetransmissionCache.get(e.toTag);if(i){this.send(i.toString()).catch(n=>{this.logTransportError(n,"Failed to send retransmission of ACK to 2xx response.")});return}return}break;case k.Completed:if(t>=300&&t<=699){this.ack(e);return}break;case k.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const s=`Received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(s)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(k.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(e){const t=this.request.ruri,s=this.request.callId,i=this.request.cseq,n=this.request.getHeader("from"),a=e.getHeader("to"),o=this.request.getHeader("via"),d=this.request.getHeader("route");if(!n)throw new Error("From undefined.");if(!a)throw new Error("To undefined.");if(!o)throw new Error("Via undefined.");let c=`ACK ${t} SIP/2.0\r
|
|
178
|
+
`,e}}function Aa(r){return r==="application/sdp"?"session":"render"}function ds(r){const e=typeof r=="string"?r:r.body,t=typeof r=="string"?"application/sdp":r.contentType;return{contentDisposition:Aa(t),contentType:t,content:e}}function Sa(r){return r&&typeof r.content=="string"&&typeof r.contentType=="string"&&r.contentDisposition===void 0?!0:typeof r.contentDisposition=="string"}function Ur(r){let e,t,s;if(r instanceof wr&&r.body){const i=r.parseHeader("Content-Disposition");e=i?i.type:void 0,t=r.parseHeader("Content-Type"),s=r.body}if(r instanceof Gt&&r.body){const i=r.parseHeader("Content-Disposition");e=i?i.type:void 0,t=r.parseHeader("Content-Type"),s=r.body}if(r instanceof cr&&r.body)if(e=r.getHeader("Content-Disposition"),t=r.getHeader("Content-Type"),typeof r.body=="string"){if(!t)throw new Error("Header content type header does not equal body content type.");s=r.body}else{if(t&&t!==r.body.contentType)throw new Error("Header content type header does not equal body content type.");t=r.body.contentType,s=r.body.body}if(Sa(r)&&(e=r.contentDisposition,t=r.contentType,s=r.content),!!s){if(t&&!e&&(e=Aa(t)),!e)throw new Error("Content disposition undefined.");if(!t)throw new Error("Content type undefined.");return{contentDisposition:e,contentType:t,content:s}}}var st;(function(r){r.Initial="Initial",r.Early="Early",r.AckWait="AckWait",r.Confirmed="Confirmed",r.Terminated="Terminated"})(st=st||(st={}));var Y;(function(r){r.Initial="Initial",r.HaveLocalOffer="HaveLocalOffer",r.HaveRemoteOffer="HaveRemoteOffer",r.Stable="Stable",r.Closed="Closed"})(Y=Y||(Y={}));const kt=500,V0=4e3,Ta=5e3,Ne={T1:kt,T2:V0,TIMER_B:64*kt,TIMER_D:0*kt,TIMER_F:64*kt,TIMER_H:64*kt,TIMER_I:0*Ta,TIMER_J:0*kt,TIMER_K:0*Ta,TIMER_L:64*kt,TIMER_M:64*kt,TIMER_N:64*kt,PROVISIONAL_RESPONSE_INTERVAL:6e4};class Vt extends ar{constructor(e){super(e||"Transaction state error.")}}var K;(function(r){r.ACK="ACK",r.BYE="BYE",r.CANCEL="CANCEL",r.INFO="INFO",r.INVITE="INVITE",r.MESSAGE="MESSAGE",r.NOTIFY="NOTIFY",r.OPTIONS="OPTIONS",r.REGISTER="REGISTER",r.UPDATE="UPDATE",r.SUBSCRIBE="SUBSCRIBE",r.PUBLISH="PUBLISH",r.REFER="REFER",r.PRACK="PRACK"})(K=K||(K={}));const zt=[K.ACK,K.BYE,K.CANCEL,K.INFO,K.INVITE,K.MESSAGE,K.NOTIFY,K.OPTIONS,K.PRACK,K.REFER,K.REGISTER,K.SUBSCRIBE];class Ra{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}}class Mi{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}}class z0{constructor(e,t){this.incomingReferRequest=e,this.session=t}get referTo(){const e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof ze))throw new Error("Failed to parse Refer-To header.");return e}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const e=this.referTo.uri.getHeader("replaces");return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;const t=this.referTo.uri.clone();t.clearHeaders(),e=e||{};const s=(e.extraHeaders||[]).slice(),i=this.replaces;i&&s.push("Replaces: "+decodeURIComponent(i));const n=this.referredBy;return n&&s.push("Referred-By: "+n),e.extraHeaders=s,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}}var B;(function(r){r.Initial="Initial",r.Establishing="Establishing",r.Established="Established",r.Terminating="Terminating",r.Terminated="Terminated"})(B=B||(B={}));class Lr{constructor(e,t={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=B.Initial,this.delegate=t.delegate,this._stateEventEmitter=new jr,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case B.Initial:break;case B.Establishing:break;case B.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case B.Terminating:break;case B.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let t="Session.bye() may only be called if established session.";switch(this.state){case B.Initial:typeof this.cancel=="function"?(t+=" However Inviter.invite() has not yet been called.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called.",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Establishing:typeof this.cancel=="function"?(t+=" However a dialog does not yet exist.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called (or not yet resolved).",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Established:{const s=e.requestDelegate,i=this.copyRequestOptions(e.requestOptions);return this._bye(s,i)}case B.Terminating:t+=" However this session is already terminating.",typeof this.cancel=="function"?t+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(t+=" Perhaps you have already called Session.bye()?");break;case B.Terminated:t+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(t),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==B.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,s=this.copyRequestOptions(e.requestOptions);return this._info(t,s)}invite(e={}){if(this.logger.log("Session.invite"),this.state!==B.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new $i("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);const t={onAccept:n=>{const a=Ur(n.message);if(!a){this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(n,400,"Missing session description"),this.stateTransition(B.Terminated),this.pendingReinvite=!1;return}if(e.withoutSdp){const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(a,o).then(d=>{n.ack({body:d})}).catch(d=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(d.message),this.state===B.Terminated?n.ack():(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}else{const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(a,o).then(()=>{n.ack()}).catch(d=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(d.message),this.state!==B.Terminated?(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated)):n.ack()}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}},onProgress:n=>{},onRedirect:n=>{},onReject:n=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n):this.rollbackOffer().catch(a=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(a.message),this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)})},onTrying:n=>{}},s=e.requestOptions||{};if(s.extraHeaders=(s.extraHeaders||[]).slice(),s.extraHeaders.push("Allow: "+zt.toString()),s.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(t,s))}const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(i).then(n=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return s.body=n,this.dialog.invite(t,s)}).catch(n=>{throw this.logger.error(n.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,n})}message(e={}){if(this.state!==B.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,s=this.copyRequestOptions(e.requestOptions);return this._message(t,s)}refer(e,t={}){if(this.state!==B.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(e instanceof Lr&&!e.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const s=t.requestDelegate,i=this.copyRequestOptions(t.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(t.onNotify,s,i)}_bye(e,t){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const s=this.dialog;switch(s.sessionState){case st.Initial:throw new Error(`Invalid dialog state ${s.sessionState}`);case st.Early:throw new Error(`Invalid dialog state ${s.sessionState}`);case st.AckWait:return this.stateTransition(B.Terminating),new Promise(i=>{s.delegate={onAck:()=>{const n=s.bye(e,t);return this.stateTransition(B.Terminated),i(n),Promise.resolve()},onAckTimeout:()=>{const n=s.bye(e,t);this.stateTransition(B.Terminated),i(n)}}});case st.Confirmed:{const i=s.bye(e,t);return this.stateTransition(B.Terminated),Promise.resolve(i)}case st.Terminated:throw new Error(`Invalid dialog state ${s.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(new Error("Session dialog undefined."))}_message(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(new Error("Session dialog undefined."))}_refer(e,t,s){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,s))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(e,t,s){e.ack();const i=[];t&&i.push("Reason: "+this.getReasonHeaderValue(t,s)),e.session.bye(void 0,{extraHeaders:i})}onAckRequest(e){if(this.logger.log("Session.onAckRequest"),this.state!==B.Established&&this.state!==B.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const t=this.dialog;if(!t)throw new Error("Dialog undefined.");const s={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const i=new j0(e);this.delegate.onAck(i)}switch(this.pendingReinviteAck=!1,t.signalingState){case Y.Initial:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case Y.Stable:{const i=Ur(e.message);return i?i.contentDisposition==="render"?(this._renderbody=i.content,this._rendertype=i.contentType,Promise.resolve()):i.contentDisposition!=="session"?Promise.resolve():this.setAnswer(i,s).catch(n=>{this.logger.error(n.message);const a=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];t.bye(void 0,{extraHeaders:a}),this.stateTransition(B.Terminated)}):Promise.resolve()}case Y.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case Y.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case Y.Closed:throw new Error(`Invalid signaling state ${t.signalingState}.`);default:throw new Error(`Invalid signaling state ${t.signalingState}.`)}}onByeRequest(e){if(this.logger.log("Session.onByeRequest"),this.state!==B.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){const t=new q0(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(B.Terminated)}onInfoRequest(e){if(this.logger.log("Session.onInfoRequest"),this.state!==B.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){const t=new L0(e);this.delegate.onInfo(t)}else e.accept()}onInviteRequest(e){if(this.logger.log("Session.onInviteRequest"),this.state!==B.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;const t=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){const i=e.message.getHeader("P-Asserted-Identity");if(!i)throw new Error("Header undefined.");this._assertedIdentity=Ie.nameAddrHeaderParse(i)}const s={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(s).then(i=>{const n=e.accept({statusCode:200,extraHeaders:t,body:i});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,200)}).catch(i=>{if(this.logger.error(i.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===Y.Stable){const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488);return}this.rollbackOffer().then(()=>{const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488)}).catch(n=>{this.logger.error(n.message),this.logger.error("Failed to rollback offer on re-INVITE request");const a=e.reject({statusCode:488});if(this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,a.message,488)})})}onMessageRequest(e){if(this.logger.log("Session.onMessageRequest"),this.state!==B.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){const t=new Ra(e);this.delegate.onMessage(t)}else e.accept()}onNotifyRequest(e){if(this.logger.log("Session.onNotifyRequest"),this.state!==B.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){const t=new Mi(e);this.onNotify(t);return}if(this.delegate&&this.delegate.onNotify){const t=new Mi(e);this.delegate.onNotify(t)}else e.accept()}onPrackRequest(e){if(this.logger.log("Session.onPrackRequest"),this.state!==B.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw new Error("Unimplemented.")}onReferRequest(e){if(this.logger.log("Session.onReferRequest"),this.state!==B.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!e.message.hasHeader("refer-to")){this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),e.reject();return}const t=new z0(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),t.accept().then(()=>t.makeInviter(this._referralInviterOptions).invite()).catch(s=>{this.logger.error(s.message)}))}generateResponseOfferAnswer(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);const s=Ur(e.message);return!s||s.contentDisposition!=="session"?this.getOffer(t):this.setOfferAndGetAnswer(s,t)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case Y.Initial:return this.getOffer(e);case Y.HaveLocalOffer:return Promise.resolve(void 0);case Y.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case Y.Stable:return this.state!==B.Established?Promise.resolve(void 0):this.getOffer(e);case Y.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){const t=this.setupSessionDescriptionHandler(),s=e.sessionDescriptionHandlerOptions,i=e.sessionDescriptionHandlerModifiers;try{return t.getDescription(s,i).then(n=>ds(n)).catch(n=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const a=n instanceof Error?n:new Error("Session.getOffer unknown error.");throw this.logger.error(a.message),a})}catch(n){this.logger.error("Session.getOffer: SDH getDescription threw...");const a=n instanceof Error?n:new Error(n);return this.logger.error(a.message),Promise.reject(a)}}rollbackOffer(){const e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(t=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const s=t instanceof Error?t:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(s.message),s})}catch(t){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const s=t instanceof Error?t:new Error(t);return this.logger.error(s.message),Promise.reject(s)}}setAnswer(e,t){const s=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!s.hasDescription(e.contentType))return Promise.reject(new Pi)}catch(a){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return s.setDescription(e.content,i,n).catch(a=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const o=a instanceof Error?a:new Error("Session.setAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setAnswer: SDH setDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setOfferAndGetAnswer(e,t){const s=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!s.hasDescription(e.contentType))return Promise.reject(new Pi)}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return s.setDescription(e.content,i,n).then(()=>s.getDescription(i,n)).then(a=>ds(a)).catch(a=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const o=a instanceof Error?a:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){var e;return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((e=this.delegate)===null||e===void 0)&&e.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case B.Initial:e!==B.Establishing&&e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Establishing:e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Established:e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Terminating:e!==B.Terminated&&t();break;case B.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===B.Terminated&&this.dispose()}copyRequestOptions(e={}){const t=e.extraHeaders?e.extraHeaders.slice():void 0,s=e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0;return{extraHeaders:t,body:s}}getReasonHeaderValue(e,t){const s=e;let i=cs(e);return!i&&t&&(i=t),"SIP;cause="+s+';text="'+i+'"'}referExtraHeaders(e){const t=[];return t.push("Referred-By: <"+this.userAgent.configuration.uri+">"),t.push("Contact: "+this._contact),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),t.push("Refer-To: "+e),t}referToString(e){let t;if(e instanceof yt)t=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");const s=e.remoteIdentity.friendlyName,i=e.dialog.remoteTarget.toString(),n=e.dialog.callId,a=e.dialog.remoteTag,o=e.dialog.localTag,d=encodeURIComponent(`${n};to-tag=${a};from-tag=${o}`);t=`"${s}" <${i}?Replaces=${d}>`}return t}}var ht;(function(r){r.Required="Required",r.Supported="Supported",r.Unsupported="Unsupported"})(ht=ht||(ht={}));const K0={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};class Z0 extends Lr{constructor(e,t){super(e),this.incomingInviteRequest=t,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger("sip.Invitation");const s=this.incomingInviteRequest.message,i=s.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(this.rel100="required");const n=s.getHeader("supported");if(n&&n.toLowerCase().includes("100rel")&&(this.rel100="supported"),s.toTag=t.toTag,typeof s.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{t.reject({statusCode:480}),this.stateTransition(B.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),s.hasHeader("expires")){const d=Number(s.getHeader("expires")||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===B.Initial&&(t.reject({statusCode:487}),this.stateTransition(B.Terminated))},d)}const a=this.request.getHeader("P-Asserted-Identity");a&&(this._assertedIdentity=Ie.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();const o=s.parseHeader("Content-Disposition");o&&o.type==="render"&&(this._renderbody=s.body,this._rendertype=s.getHeader("Content-Type")),this._id=s.callId+s.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case B.Initial:return this.reject().then(()=>super.dispose());case B.Establishing:return this.reject().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log("Invitation.accept"),this.state!==B.Initial){const t=new Error(`Invalid session state ${this.state}`);return this.logger.error(t.message),Promise.reject(t)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(B.Establishing),this.sendAccept(e).then(({message:t,session:s})=>{s.delegate={onAck:i=>this.onAckRequest(i),onAckTimeout:()=>this.onAckTimeout(),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=s,this.stateTransition(B.Established),this._replacee&&this._replacee._bye()}).catch(t=>this.handleResponseError(t))}progress(e={}){if(this.logger.log("Invitation.progress"),this.state!==B.Initial){const s=new Error(`Invalid session state ${this.state}`);return this.logger.error(s.message),Promise.reject(s)}const t=e.statusCode||180;if(t<100||t>199)throw new TypeError("Invalid statusCode: "+t);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(s=>this.handleResponseError(s)):this.rel100!=="required"&&!(this.rel100==="supported"&&e.rel100)&&!(this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===ht.Required)?this.sendProgress(e).then(()=>{}).catch(s=>this.handleResponseError(s)):this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(s=>this.handleResponseError(s))}reject(e={}){if(this.logger.log("Invitation.reject"),this.state!==B.Initial&&this.state!==B.Establishing){const a=new Error(`Invalid session state ${this.state}`);return this.logger.error(a.message),Promise.reject(a)}const t=e.statusCode||480,s=e.reasonPhrase?e.reasonPhrase:cs(t),i=e.extraHeaders||[];if(t<300||t>699)throw new TypeError("Invalid statusCode: "+t);const n=e.body?ds(e.body):void 0;return t<400?this.incomingInviteRequest.redirect([],{statusCode:t,reasonPhrase:s,extraHeaders:i,body:n}):this.incomingInviteRequest.reject({statusCode:t,reasonPhrase:s,extraHeaders:i,body:n}),this.stateTransition(B.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log("Invitation._onCancel"),this.state!==B.Initial&&this.state!==B.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){const t=new U0(e);this.delegate.onCancel(t)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(B.Terminated)}handlePrackOfferAnswer(e){if(!this.dialog)throw new Error("Dialog undefined.");const t=Ur(e.message);if(!t||t.contentDisposition!=="session")return Promise.resolve(void 0);const s={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case Y.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Y.Stable:return this.setAnswer(t,s).then(()=>{});case Y.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Y.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,s);case Y.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof Pi?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),t=415):e instanceof M0?this.logger.error("A session description handler occurred while sending response"):e instanceof Ni?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof Vt&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===B.Initial||this.state===B.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(B.Terminated)}catch(s){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),s}if(this.isCanceled){this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.");return}throw e}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(B.Terminated)}sendAccept(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},s=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,t)).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:s})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:s})))}sendProgress(e={}){const t=e.statusCode||180,s=e.reasonPhrase,i=(e.extraHeaders||[]).slice(),n=e.body?ds(e.body):void 0;if(t===183&&!n)return this.sendProgressWithSDP(e);try{const a=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:s,extraHeaders:i,body:n});return this._dialog=a.session,Promise.resolve(a)}catch(a){return Promise.reject(a)}}sendProgressWithSDP(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},s=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(a=>this.incomingInviteRequest.progress({statusCode:s,reasonPhrase:i,extraHeaders:n,body:a})).then(a=>(this._dialog=a.session,a))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},s=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();n.push("Require: 100rel"),n.push("RSeq: "+this.rseq++);let a;return new Promise((o,d)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(c=>(a=c,this.incomingInviteRequest.progress({statusCode:s,reasonPhrase:i,extraHeaders:n,body:a}))).then(c=>{this._dialog=c.session;let l,g;c.session.delegate={onPrack:x=>{l=x,clearTimeout(w),clearTimeout(C),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(l).then(p=>{try{g=l.accept({statusCode:200,body:p}),this.prackArrived(),o({prackRequest:l,prackResponse:g,progressResponse:c})}catch(E){d(E)}}).catch(p=>d(p)))}};const w=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(C),this.reject({statusCode:504}).then(()=>d(new Ni)).catch(x=>d(x)))},Ne.T1*64),y=()=>{try{this.incomingInviteRequest.progress({statusCode:s,reasonPhrase:i,extraHeaders:n,body:a})}catch(x){this.waitingForPrack=!1,d(x);return}C=setTimeout(y,b*=2)};let b=Ne.T1,C=setTimeout(y,b)}).catch(c=>{this.waitingForPrack=!1,d(c)})})}sendProgressTrying(){try{const e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((e,t)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=t}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new Ni),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}}class Fa extends Lr{constructor(e,t,s={}){super(e,s),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger("sip.Inviter"),this.earlyMedia=s.earlyMedia!==void 0?s.earlyMedia:this.earlyMedia,this.fromTag=ls(),this.inviteWithoutSdp=s.inviteWithoutSdp!==void 0?s.inviteWithoutSdp:this.inviteWithoutSdp;const i=Object.assign({},s);i.params=Object.assign({},s.params);const n=s.anonymous||!1,a=e.contact.toString({anonymous:n,outbound:n?!e.contact.tempGruu:!e.contact.pubGruu});n&&e.configuration.uri&&(i.params.fromDisplayName="Anonymous",i.params.fromUri="sip:anonymous@anonymous.invalid");let o=e.userAgentCore.configuration.aor;if(i.params.fromUri&&(o=typeof i.params.fromUri=="string"?Ie.URIParse(i.params.fromUri):i.params.fromUri),!o)throw new TypeError("Invalid from URI: "+i.params.fromUri);let d=t;if(i.params.toUri&&(d=typeof i.params.toUri=="string"?Ie.URIParse(i.params.toUri):i.params.toUri),!d)throw new TypeError("Invalid to URI: "+i.params.toUri);const c=Object.assign({},i.params);c.fromTag=this.fromTag;const l=(i.extraHeaders||[]).slice();n&&e.configuration.uri&&(l.push("P-Preferred-Identity: "+e.configuration.uri.toString()),l.push("Privacy: id")),l.push("Contact: "+a),l.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),e.configuration.sipExtension100rel===ht.Required&&l.push("Require: 100rel"),e.configuration.sipExtensionReplaces===ht.Required&&l.push("Require: replaces"),i.extraHeaders=l;const g=void 0;this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(K.INVITE,t,o,d,c,l,g),this._contact=a,this._referralInviterOptions=i,this._renderbody=s.renderbody,this._rendertype=s.rendertype,s.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=s.sessionDescriptionHandlerModifiers),s.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=s.sessionDescriptionHandlerOptions),s.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=s.sessionDescriptionHandlerModifiersReInvite),s.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=s.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case B.Initial:return this.cancel().then(()=>super.dispose());case B.Establishing:return this.cancel().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log("Inviter.cancel"),this.state!==B.Initial&&this.state!==B.Establishing){const s=new Error(`Invalid session state ${this.state}`);return this.logger.error(s.message),Promise.reject(s)}this.isCanceled=!0,this.stateTransition(B.Terminating);function t(s,i){if(s&&s<200||s>699)throw new TypeError("Invalid statusCode: "+s);if(s){const n=s,a=cs(s)||i;return"SIP;cause="+n+';text="'+a+'"'}}if(this.outgoingInviteRequest){let s;e.statusCode&&e.reasonPhrase&&(s=t(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(s,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(B.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log("Inviter.invite"),this.state!==B.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(B.Establishing),Promise.resolve(this.sendInvite(e));const t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(t).then(s=>(this.outgoingRequestMessage.body={body:s.content,contentType:s.contentType},this.stateTransition(B.Establishing),this.sendInvite(e))).catch(s=>{throw this.logger.log(s.message),this.state!==B.Terminated&&this.stateTransition(B.Terminated),s})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:t=>{if(this.dialog){this.logger.log("Additional confirmed dialog, sending ACK and BYE"),this.ackAndBye(t);return}if(this.isCanceled){this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(t),this.stateTransition(B.Terminated);return}this.notifyReferer(t),this.onAccept(t).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})},onProgress:t=>{this.isCanceled||(this.notifyReferer(t),this.onProgress(t).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)}))},onRedirect:t=>{this.notifyReferer(t),this.onRedirect(t),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t)},onReject:t=>{this.notifyReferer(t),this.onReject(t),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)},onTrying:t=>{this.notifyReferer(t),this.onTrying(t),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Lr))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");const t=e.message.statusCode,s=e.message.reasonPhrase,i=`SIP/2.0 ${t} ${s}`.trim(),n=this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:i}});n.delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log("Inviter.onAccept"),this.state!==B.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.message,s=e.session;switch(t.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Ie.nameAddrHeaderParse(t.getHeader("P-Asserted-Identity"))),s.delegate={onAck:i=>this.onAckRequest(i),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=s,s.signalingState){case Y.Initial:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case Y.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case Y.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,i).then(n=>{e.ack({body:n}),this.stateTransition(B.Established)}).catch(n=>{throw this.ackAndBye(e,488,"Invalid session description"),this.stateTransition(B.Terminated),n})}case Y.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const a=this.earlyMediaSessionDescriptionHandlers.get(s.id);if(!a)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(a),this.earlyMediaSessionDescriptionHandlers.delete(s.id),e.ack(),this.stateTransition(B.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==s){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const a=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),Promise.reject(a)}return e.ack(),this.stateTransition(B.Established),Promise.resolve()}const i=s.answer;if(!i)throw new Error("Answer is undefined.");const n={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(i,n).then(()=>{let a;this._renderbody&&this._rendertype&&(a={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),e.ack(a),this.stateTransition(B.Established)}).catch(a=>{throw this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),a})}case Y.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(e){var t;if(this.logger.log("Inviter.onProgress"),this.state!==B.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const s=e.message,i=e.session;s.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Ie.nameAddrHeaderParse(s.getHeader("P-Asserted-Identity")));const n=s.getHeader("require"),a=s.getHeader("rseq"),d=!!(n&&n.includes("100rel")&&a?Number(a):void 0),c=[];switch(d&&c.push("RAck: "+s.getHeader("rseq")+" "+s.getHeader("cseq")),i.signalingState){case Y.Initial:return d&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:c})),Promise.resolve();case Y.HaveLocalOffer:return d&&e.prack({extraHeaders:c}),Promise.resolve();case Y.HaveRemoteOffer:if(!d)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const l=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((t=this.delegate)===null||t===void 0)&&t.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(l,!0),this.earlyMediaSessionDescriptionHandlers.set(i.id,l),l.setDescription(s.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>l.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(g=>{const f={contentDisposition:"session",contentType:g.contentType,content:g.body};e.prack({extraHeaders:c,body:f})}).catch(g=>{throw this.stateTransition(B.Terminated),g})}case Y.Stable:if(d&&e.prack({extraHeaders:c}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=i;const l=i.answer;if(!l)throw new Error("Answer is undefined.");const g={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(l,g).catch(f=>{throw this.stateTransition(B.Terminated),f})}return Promise.resolve();case Y.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(e){if(this.logger.log("Inviter.onRedirect"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onReject(e){if(this.logger.log("Inviter.onReject"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onTrying(e){if(this.logger.log("Inviter.onTrying"),this.state!==B.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}}var me;(function(r){r.Initial="Initial",r.Registered="Registered",r.Unregistered="Unregistered",r.Terminated="Terminated"})(me=me||(me={}));class Et{constructor(e,t={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=me.Initial,this._waiting=!1,this._stateEventEmitter=new jr,this._waitingEventEmitter=new jr,this.userAgent=e;const s=e.configuration.uri.clone();if(s.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},Et.defaultOptions()),{registrar:s}),Et.stripUndefinedProperties(t)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&Ie.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const i=this.options.registrar,n=this.options.params&&this.options.params.fromUri||e.userAgentCore.configuration.aor,a=this.options.params&&this.options.params.toUri||e.configuration.uri,o=this.options.params||{},d=(t.extraHeaders||[]).slice();if(this.request=e.userAgentCore.makeOutgoingRequestMessage(K.REGISTER,i,n,a,o,d,void 0),this.expires=this.options.expires||Et.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||Et.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=e.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(c=>{const l=this.options[c];switch(c){case"registrar":this.logger.log("· "+c+": "+l);break;default:this.logger.log("· "+c+": "+JSON.stringify(l))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:Et.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new yt("sip","anonymous","anonymous.invalid"),refreshFrequency:Et.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,s)=>(e[s]!==void 0&&(t[s]=e[s]),t),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{const t=()=>{if(!this.waiting&&this._state===me.Registered){this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),this.unregister();return}this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{t()},{once:!0}):t()}))}register(e={}){if(this.state===me.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new $i("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));const t=(this.options.extraHeaders||[]).slice();t.push("Contact: "+this.generateContactHeader(this.expires)),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=t,this.waitingToggle(!0);const s=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{let n;i.message.hasHeader("expires")&&(n=Number(i.message.getHeader("expires"))),this._contacts=i.message.getHeaders("contact");let a=this._contacts.length;if(!a){this.logger.error("No Contact header in response to REGISTER, dropping response."),this.unregistered();return}let o;for(;a--;){if(o=i.message.parseHeader("contact",a),!o)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&_a(o.uri,this.userAgent.contact.pubGruu)){n=Number(o.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(o.uri.user===this.userAgent.contact.uri.user){n=Number(o.getParam("expires"));break}}else if(_a(o.uri,this.userAgent.contact.uri)){n=Number(o.getParam("expires"));break}o=void 0}if(o===void 0){this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(n===void 0){this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(o.hasParam("temp-gruu")){const d=o.getParam("temp-gruu");d&&(this.userAgent.contact.tempGruu=Ie.URIParse(d.replace(/"/g,"")))}if(o.hasParam("pub-gruu")){const d=o.getParam("pub-gruu");d&&(this.userAgent.contact.pubGruu=Ie.URIParse(d.replace(/"/g,"")))}this.registered(n),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{if(i.message.statusCode===423){if(!i.message.hasHeader("min-expires")){this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(i.message.getHeader("min-expires")),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${i.message.statusCode}`);let n=NaN;if(i.message.statusCode===500||i.message.statusCode===503){const a=i.message.getHeader("retry-after");a&&(n=Number.parseInt(a,void 0))}this._retryAfter=isNaN(n)?void 0:n,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(s)}unregister(e={}){if(this.state===me.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==me.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new $i("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}this._state!==me.Registered&&!e.all&&this.logger.warn("Not currently registered, but sending an unregister anyway.");const t=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=t,e.all?(t.push("Contact: *"),t.push("Expires: 0")):t.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const s=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{this._contacts=i.message.getHeaders("contact"),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{this.logger.error(`Unregister rejected with status code ${i.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(s)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let t=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(t+=";reg-id="+this.options.regId,t+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(s=>{t+=";"+s}),t+=";expires="+e,t}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},e*1e3),this._state!==me.Registered&&this.stateTransition(me.Registered)}unregistered(){this.clearTimers(),this._state!==me.Unregistered&&this.stateTransition(me.Unregistered)}terminated(){this.clearTimers(),this._state!==me.Terminated&&this.stateTransition(me.Terminated)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case me.Initial:e!==me.Registered&&e!==me.Unregistered&&e!==me.Terminated&&t();break;case me.Registered:e!==me.Unregistered&&e!==me.Terminated&&t();break;case me.Unregistered:e!==me.Registered&&e!==me.Terminated&&t();break;case me.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===me.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw new Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let e="An attempt was made to send a REGISTER request while a prior one was still in progress.";e+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",e+=" from the registrar for the previous one or the previous REGISTER request has timed out.",e+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",e+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn(e)}stateError(){let t=`An attempt was made to send a REGISTER request when the Registerer ${this.state===me.Terminated?"is in 'Terminated' state":"has been disposed"}.`;t+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",t+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(t)}}Et.defaultExpires=600,Et.defaultRefreshFrequency=99;var fe;(function(r){r.Initial="Initial",r.NotifyWait="NotifyWait",r.Pending="Pending",r.Active="Active",r.Terminated="Terminated"})(fe=fe||(fe={}));var ee;(function(r){r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Disconnected="Disconnected"})(ee=ee||(ee={}));var je;(function(r){r.Started="Started",r.Stopped="Stopped"})(je=je||(je={}));class Fe{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){const t=Fe.hexChars,s=Fe.hexOut;let i,n,a,o;for(o=0;o<4;o+=1)for(n=o*8,i=e[o],a=0;a<8;a+=2)s[n+1+a]=t.charAt(i&15),i>>>=4,s[n+0+a]=t.charAt(i&15),i>>>=4;return s.join("")}static _md5cycle(e,t){let s=e[0],i=e[1],n=e[2],a=e[3];s+=(i&n|~i&a)+t[0]-680876936|0,s=(s<<7|s>>>25)+i|0,a+=(s&i|~s&n)+t[1]-389564586|0,a=(a<<12|a>>>20)+s|0,n+=(a&s|~a&i)+t[2]+606105819|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&s)+t[3]-1044525330|0,i=(i<<22|i>>>10)+n|0,s+=(i&n|~i&a)+t[4]-176418897|0,s=(s<<7|s>>>25)+i|0,a+=(s&i|~s&n)+t[5]+1200080426|0,a=(a<<12|a>>>20)+s|0,n+=(a&s|~a&i)+t[6]-1473231341|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&s)+t[7]-45705983|0,i=(i<<22|i>>>10)+n|0,s+=(i&n|~i&a)+t[8]+1770035416|0,s=(s<<7|s>>>25)+i|0,a+=(s&i|~s&n)+t[9]-1958414417|0,a=(a<<12|a>>>20)+s|0,n+=(a&s|~a&i)+t[10]-42063|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&s)+t[11]-1990404162|0,i=(i<<22|i>>>10)+n|0,s+=(i&n|~i&a)+t[12]+1804603682|0,s=(s<<7|s>>>25)+i|0,a+=(s&i|~s&n)+t[13]-40341101|0,a=(a<<12|a>>>20)+s|0,n+=(a&s|~a&i)+t[14]-1502002290|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&s)+t[15]+1236535329|0,i=(i<<22|i>>>10)+n|0,s+=(i&a|n&~a)+t[1]-165796510|0,s=(s<<5|s>>>27)+i|0,a+=(s&n|i&~n)+t[6]-1069501632|0,a=(a<<9|a>>>23)+s|0,n+=(a&i|s&~i)+t[11]+643717713|0,n=(n<<14|n>>>18)+a|0,i+=(n&s|a&~s)+t[0]-373897302|0,i=(i<<20|i>>>12)+n|0,s+=(i&a|n&~a)+t[5]-701558691|0,s=(s<<5|s>>>27)+i|0,a+=(s&n|i&~n)+t[10]+38016083|0,a=(a<<9|a>>>23)+s|0,n+=(a&i|s&~i)+t[15]-660478335|0,n=(n<<14|n>>>18)+a|0,i+=(n&s|a&~s)+t[4]-405537848|0,i=(i<<20|i>>>12)+n|0,s+=(i&a|n&~a)+t[9]+568446438|0,s=(s<<5|s>>>27)+i|0,a+=(s&n|i&~n)+t[14]-1019803690|0,a=(a<<9|a>>>23)+s|0,n+=(a&i|s&~i)+t[3]-187363961|0,n=(n<<14|n>>>18)+a|0,i+=(n&s|a&~s)+t[8]+1163531501|0,i=(i<<20|i>>>12)+n|0,s+=(i&a|n&~a)+t[13]-1444681467|0,s=(s<<5|s>>>27)+i|0,a+=(s&n|i&~n)+t[2]-51403784|0,a=(a<<9|a>>>23)+s|0,n+=(a&i|s&~i)+t[7]+1735328473|0,n=(n<<14|n>>>18)+a|0,i+=(n&s|a&~s)+t[12]-1926607734|0,i=(i<<20|i>>>12)+n|0,s+=(i^n^a)+t[5]-378558|0,s=(s<<4|s>>>28)+i|0,a+=(s^i^n)+t[8]-2022574463|0,a=(a<<11|a>>>21)+s|0,n+=(a^s^i)+t[11]+1839030562|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^s)+t[14]-35309556|0,i=(i<<23|i>>>9)+n|0,s+=(i^n^a)+t[1]-1530992060|0,s=(s<<4|s>>>28)+i|0,a+=(s^i^n)+t[4]+1272893353|0,a=(a<<11|a>>>21)+s|0,n+=(a^s^i)+t[7]-155497632|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^s)+t[10]-1094730640|0,i=(i<<23|i>>>9)+n|0,s+=(i^n^a)+t[13]+681279174|0,s=(s<<4|s>>>28)+i|0,a+=(s^i^n)+t[0]-358537222|0,a=(a<<11|a>>>21)+s|0,n+=(a^s^i)+t[3]-722521979|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^s)+t[6]+76029189|0,i=(i<<23|i>>>9)+n|0,s+=(i^n^a)+t[9]-640364487|0,s=(s<<4|s>>>28)+i|0,a+=(s^i^n)+t[12]-421815835|0,a=(a<<11|a>>>21)+s|0,n+=(a^s^i)+t[15]+530742520|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^s)+t[2]-995338651|0,i=(i<<23|i>>>9)+n|0,s+=(n^(i|~a))+t[0]-198630844|0,s=(s<<6|s>>>26)+i|0,a+=(i^(s|~n))+t[7]+1126891415|0,a=(a<<10|a>>>22)+s|0,n+=(s^(a|~i))+t[14]-1416354905|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~s))+t[5]-57434055|0,i=(i<<21|i>>>11)+n|0,s+=(n^(i|~a))+t[12]+1700485571|0,s=(s<<6|s>>>26)+i|0,a+=(i^(s|~n))+t[3]-1894986606|0,a=(a<<10|a>>>22)+s|0,n+=(s^(a|~i))+t[10]-1051523|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~s))+t[1]-2054922799|0,i=(i<<21|i>>>11)+n|0,s+=(n^(i|~a))+t[8]+1873313359|0,s=(s<<6|s>>>26)+i|0,a+=(i^(s|~n))+t[15]-30611744|0,a=(a<<10|a>>>22)+s|0,n+=(s^(a|~i))+t[6]-1560198380|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~s))+t[13]+1309151649|0,i=(i<<21|i>>>11)+n|0,s+=(n^(i|~a))+t[4]-145523070|0,s=(s<<6|s>>>26)+i|0,a+=(i^(s|~n))+t[11]-1120210379|0,a=(a<<10|a>>>22)+s|0,n+=(s^(a|~i))+t[2]+718787259|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~s))+t[9]-343485551|0,i=(i<<21|i>>>11)+n|0,e[0]=s+e[0]|0,e[1]=i+e[1]|0,e[2]=n+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(Fe.stateIdentity),this}appendStr(e){const t=this._buffer8,s=this._buffer32;let i=this._bufferLength,n,a;for(a=0;a<e.length;a+=1){if(n=e.charCodeAt(a),n<128)t[i++]=n;else if(n<2048)t[i++]=(n>>>6)+192,t[i++]=n&63|128;else if(n<55296||n>56319)t[i++]=(n>>>12)+224,t[i++]=n>>>6&63|128,t[i++]=n&63|128;else{if(n=(n-55296)*1024+(e.charCodeAt(++a)-56320)+65536,n>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(n>>>18)+240,t[i++]=n>>>12&63|128,t[i++]=n>>>6&63|128,t[i++]=n&63|128}i>=64&&(this._dataLength+=64,Fe._md5cycle(this._state,s),i-=64,s[0]=s[16])}return this._bufferLength=i,this}appendAsciiStr(e){const t=this._buffer8,s=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e.charCodeAt(a++);if(i<64)break;this._dataLength+=64,Fe._md5cycle(this._state,s),i=0}return this._bufferLength=i,this}appendByteArray(e){const t=this._buffer8,s=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e[a++];if(i<64)break;this._dataLength+=64,Fe._md5cycle(this._state,s),i=0}return this._bufferLength=i,this}getState(){const e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){const t=e.buffer,s=e.state,i=this._state;let n;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],n=0;n<t.length;n+=1)this._buffer8[n]=t.charCodeAt(n)}end(e=!1){const t=this._bufferLength,s=this._buffer8,i=this._buffer32,n=(t>>2)+1;let a;if(this._dataLength+=t,s[t]=128,s[t+1]=s[t+2]=s[t+3]=0,i.set(Fe.buffer32Identity.subarray(n),n),t>55&&(Fe._md5cycle(this._state,i),i.set(Fe.buffer32Identity)),a=this._dataLength*8,a<=4294967295)i[14]=a;else{const o=a.toString(16).match(/(.*?)(.{0,8})$/);if(o===null)return;const d=parseInt(o[2],16),c=parseInt(o[1],16)||0;i[14]=d,i[15]=c}return Fe._md5cycle(this._state,i),e?this._state:Fe._hex(this._state)}}Fe.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),Fe.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Fe.hexChars="0123456789abcdef",Fe.hexOut=[],Fe.onePassHasher=new Fe,Fe.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");function Kt(r){return Fe.hashStr(r)}class X0{constructor(e,t,s,i){this.logger=e.getLogger("sipjs.digestauthentication"),this.username=s,this.password=i,this.ha1=t,this.nc=0,this.ncHex="00000000"}authenticate(e,t,s){if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else if(t.qop.indexOf("auth-int")>-1)this.qop="auth-int";else return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=or(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(s),!0}toString(){const e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}updateNcHex(){const e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e}calculateResponse(e){let t,s;t=this.ha1,(t===""||t===void 0)&&(t=Kt(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(s=Kt(this.method+":"+this.uri),this.response=Kt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+s)):this.qop==="auth-int"?(s=Kt(this.method+":"+this.uri+":"+Kt(e||"")),this.response=Kt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+s)):this.qop===void 0&&(s=Kt(this.method+":"+this.uri),this.response=Kt(t+":"+this.nonce+":"+s))}}var Oe;(function(r){r[r.error=0]="error",r[r.warn=1]="warn",r[r.log=2]="log",r[r.debug=3]="debug"})(Oe=Oe||(Oe={}));class ka{constructor(e,t,s){this.logger=e,this.category=t,this.label=s}error(e){this.genericLog(Oe.error,e)}warn(e){this.genericLog(Oe.warn,e)}log(e){this.genericLog(Oe.log,e)}debug(e){this.genericLog(Oe.debug,e)}genericLog(e,t){this.logger.genericLog(e,this.category,this.label,t)}get level(){return this.logger.level}set level(e){this.logger.level=e}}class J0{constructor(){this.builtinEnabled=!0,this._level=Oe.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:Oe.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e=="function"?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0}getLogger(e,t){if(t&&this.level===3)return new ka(this,e,t);if(this.loggers[e])return this.loggers[e];{const s=new ka(this,e);return this.loggers[e]=s,s}}genericLog(e,t,s,i){this.level>=e&&this.builtinEnabled&&this.print(e,t,s,i),this.connector&&this.connector(Oe[e],t,s,i)}print(e,t,s,i){if(typeof i=="string"){const n=[new Date,t];s&&n.push(s),i=n.concat(i).join(" | ")}switch(e){case Oe.error:console.error(i);break;case Oe.warn:console.warn(i);break;case Oe.log:console.log(i);break;case Oe.debug:console.debug(i);break}}}var hs;(function(r){function e(i,n){let a=n,o=0,d=0;if(i.substring(a,a+2).match(/(^\r\n)/))return-2;for(;o===0;){if(d=i.indexOf(`\r
|
|
179
|
+
`,a),d===-1)return d;!i.substring(d+2,d+4).match(/(^\r\n)/)&&i.charAt(d+2).match(/(^\s+)/)?a=d+2:o=d}return o}r.getHeader=e;function t(i,n,a,o){const d=n.indexOf(":",a),c=n.substring(a,d).trim(),l=n.substring(d+1,o).trim();let g;switch(c.toLowerCase()){case"via":case"v":i.addHeader("via",l),i.getHeaders("via").length===1?(g=i.parseHeader("Via"),g&&(i.via=g,i.viaBranch=g.branch)):g=0;break;case"from":case"f":i.setHeader("from",l),g=i.parseHeader("from"),g&&(i.from=g,i.fromTag=g.getParam("tag"));break;case"to":case"t":i.setHeader("to",l),g=i.parseHeader("to"),g&&(i.to=g,i.toTag=g.getParam("tag"));break;case"record-route":if(g=Ie.parse(l,"Record_Route"),g===-1){g=void 0;break}if(!(g instanceof Array)){g=void 0;break}g.forEach(f=>{i.addHeader("record-route",l.substring(f.position,f.offset)),i.headers["Record-Route"][i.getHeaders("record-route").length-1].parsed=f.parsed});break;case"call-id":case"i":i.setHeader("call-id",l),g=i.parseHeader("call-id"),g&&(i.callId=l);break;case"contact":case"m":if(g=Ie.parse(l,"Contact"),g===-1){g=void 0;break}if(!(g instanceof Array)){g=void 0;break}g.forEach(f=>{i.addHeader("contact",l.substring(f.position,f.offset)),i.headers.Contact[i.getHeaders("contact").length-1].parsed=f.parsed});break;case"content-length":case"l":i.setHeader("content-length",l),g=i.parseHeader("content-length");break;case"content-type":case"c":i.setHeader("content-type",l),g=i.parseHeader("content-type");break;case"cseq":i.setHeader("cseq",l),g=i.parseHeader("cseq"),g&&(i.cseq=g.value),i instanceof Gt&&(i.method=g.method);break;case"max-forwards":i.setHeader("max-forwards",l),g=i.parseHeader("max-forwards");break;case"www-authenticate":i.setHeader("www-authenticate",l),g=i.parseHeader("www-authenticate");break;case"proxy-authenticate":i.setHeader("proxy-authenticate",l),g=i.parseHeader("proxy-authenticate");break;case"refer-to":case"r":i.setHeader("refer-to",l),g=i.parseHeader("refer-to"),g&&(i.referTo=g);break;default:i.addHeader(c.toLowerCase(),l),g=0}return g===void 0?{error:"error parsing header '"+c+"'"}:!0}r.parseHeader=t;function s(i,n){let a=0,o=i.indexOf(`\r
|
|
180
|
+
`);if(o===-1){n.warn("no CRLF found, not a SIP message, discarded");return}const d=i.substring(0,o),c=Ie.parse(d,"Request_Response");let l;if(c===-1){n.warn('error parsing first line of SIP message: "'+d+'"');return}else c.status_code?(l=new Gt,l.statusCode=c.status_code,l.reasonPhrase=c.reason_phrase):(l=new wr,l.method=c.method,l.ruri=c.uri);l.data=i,a=o+2;let g;for(;;){if(o=e(i,a),o===-2){g=a+2;break}else if(o===-1){n.error("malformed message");return}const f=t(l,i,a,o);if(f&&f!==!0){n.error(f.error);return}a=o+2}return l.hasHeader("content-length")?l.body=i.substr(g,Number(l.getHeader("content-length"))):l.body=i.substring(g),l}r.parseMessage=s})(hs=hs||(hs={}));function Ba(r,e){const t=`\r
|
|
181
|
+
`;if(e.statusCode<100||e.statusCode>699)throw new TypeError("Invalid statusCode: "+e.statusCode);const s=e.reasonPhrase?e.reasonPhrase:cs(e.statusCode);let i="SIP/2.0 "+e.statusCode+" "+s+t;e.statusCode>=100&&e.statusCode<200,e.statusCode;const n="From: "+r.getHeader("From")+t,a="Call-ID: "+r.callId+t,o="CSeq: "+r.cseq+" "+r.method+t,d=r.getHeaders("via").reduce((w,y)=>w+"Via: "+y+t,"");let c="To: "+r.getHeader("to");if(e.statusCode>100&&!r.parseHeader("to").hasParam("tag")){let w=e.toTag;w||(w=ls()),c+=";tag="+w}c+=t;let l="";e.supported&&(l="Supported: "+e.supported.join(", ")+t);let g="";e.userAgent&&(g="User-Agent: "+e.userAgent+t);let f="";return e.extraHeaders&&(f=e.extraHeaders.reduce((w,y)=>w+y.trim()+t,"")),i+=d,i+=n,i+=c,i+=o,i+=a,i+=l,i+=g,i+=f,e.body?(i+="Content-Type: "+e.body.contentType+t,i+="Content-Length: "+qr(e.body.content)+t+t,i+=e.body.content):i+="Content-Length: 0"+t+t,{message:i}}class ji extends ar{constructor(e){super(e||"Unspecified transport error.")}}class Ia{constructor(e,t,s,i,n){this._transport=e,this._user=t,this._id=s,this._state=i,this.listeners=new Array,this.logger=t.loggerFactory.getLogger(n,s),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,t){const s=()=>{this.removeStateChangeListener(s),e()};(t==null?void 0:t.once)===!0?this.listeners.push(s):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}logTransportError(e,t){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(t)}send(e){return this.transport.send(e).catch(t=>{if(t instanceof ji)throw this.onTransportError(t),t;let s;throw t&&typeof t.message=="string"?s=new ji(t.message):s=new ji,this.onTransportError(s),s})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}}class Ha extends Ia{constructor(e,t,s,i,n){super(t,s,e.viaBranch,i,n),this._request=e,this.user=s}get request(){return this._request}}var k;(function(r){r.Accepted="Accepted",r.Calling="Calling",r.Completed="Completed",r.Confirmed="Confirmed",r.Proceeding="Proceeding",r.Terminated="Terminated",r.Trying="Trying"})(k=k||(k={}));class Ke extends Ha{constructor(e,t,s){super(e,t,s,k.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(e){switch(this.state){case k.Proceeding:if(e.method===K.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(s=>{this.logTransportError(s,"Failed to send retransmission of provisional response.")});return}break;case k.Accepted:if(e.method===K.INVITE)return;break;case k.Completed:if(e.method===K.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");this.send(this.lastFinalResponse).catch(s=>{this.logTransportError(s,"Failed to send retransmission of final response.")});return}if(e.method===K.ACK){this.stateTransition(k.Confirmed);return}break;case k.Confirmed:if(e.method===K.INVITE||e.method===K.ACK)return;break;case k.Terminated:if(e.method===K.INVITE||e.method===K.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const t=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(t)}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);switch(this.state){case k.Proceeding:if(e>=100&&e<=199){this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 1xx response.")});return}if(e>=200&&e<=299){this.lastFinalResponse=t,this.stateTransition(k.Accepted),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}if(e>=300&&e<=699){this.lastFinalResponse=t,this.stateTransition(k.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send non-2xx final response.")});return}break;case k.Accepted:if(e>=200&&e<=299){this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}break;case k.Completed:break;case k.Confirmed:break;case k.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const s=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(s),new Error(s)}retransmitAcceptedResponse(){this.state===k.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return"INVITE server transaction"}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case k.Proceeding:t();break;case k.Accepted:case k.Completed:this.state!==k.Proceeding&&t();break;case k.Confirmed:this.state!==k.Completed&&t();break;case k.Terminated:this.state!==k.Accepted&&this.state!==k.Completed&&this.state!==k.Confirmed&&t();break;default:t()}this.stopProgressExtensionTimer(),e===k.Accepted&&(this.L=setTimeout(()=>this.timerL(),Ne.TIMER_L)),e===k.Completed&&(this.H=setTimeout(()=>this.timerH(),Ne.TIMER_H)),e===k.Confirmed&&(this.I=setTimeout(()=>this.timerI(),Ne.TIMER_I)),e===k.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")})},Ne.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===k.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(k.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(k.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===k.Accepted&&this.stateTransition(k.Terminated)}}class us extends Ia{constructor(e,t,s,i,n){super(t,s,us.makeId(e),i,n),this._request=e,this.user=s,e.setViaHeader(this.id,t.protocol)}static makeId(e){if(e.method==="CANCEL"){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}else return"z9hG4bK"+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}}class Qe extends us{constructor(e,t,s){super(e,t,s,k.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),Ne.TIMER_F),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case k.Trying:if(t>=100&&t<=199){this.stateTransition(k.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=699){if(this.stateTransition(k.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case k.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699){if(this.stateTransition(k.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case k.Completed:return;case k.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const s=`Non-INVITE client transaction received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(s)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(k.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(e,t=!1){const s=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case k.Trying:s();break;case k.Proceeding:this.state!==k.Trying&&s();break;case k.Completed:this.state!==k.Trying&&this.state!==k.Proceeding&&s();break;case k.Terminated:this.state!==k.Trying&&this.state!==k.Proceeding&&this.state!==k.Completed&&(t||s());break;default:s()}e===k.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),Ne.TIMER_K)),e===k.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===k.Trying||this.state===k.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(k.Terminated))}timerK(){this.state===k.Completed&&this.stateTransition(k.Terminated)}}class Er{constructor(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,t){const i=t.getHeaders("record-route").reverse(),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof ze))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,d=void 0,c=e.callId,l=e.fromTag,g=t.toTag;if(!c)throw new Error("Call id undefined.");if(!l)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const f=e.from.uri,w=e.to.uri;if(!t.statusCode)throw new Error("Incoming response status code undefined.");const y=t.statusCode<200;return{id:c+l+g,early:y,callId:c,localTag:l,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:d,localURI:f,remoteURI:w,remoteTarget:a,routeSet:i,secure:!1}}static initialDialogStateForUserAgentServer(e,t,s=!1){const n=e.getHeaders("record-route"),a=e.parseHeader("contact");if(!a)throw new Error("Contact undefined.");if(!(a instanceof ze))throw new Error("Contact not instance of NameAddrHeader.");const o=a.uri,d=e.cseq,c=void 0,l=e.callId,g=t,f=e.fromTag,w=e.from.uri,y=e.to.uri;return{id:l+g+f,early:s,callId:l,localTag:g,remoteTag:f,localSequenceNumber:c,remoteSequenceNumber:d,localURI:y,remoteURI:w,remoteTarget:o,routeSet:n,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==K.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()}createOutgoingRequestMessage(e,t){const s=this.remoteURI,i=this.remoteTag,n=this.localURI,a=this.localTag,o=this.callId;let d;t&&t.cseq?d=t.cseq:this.dialogState.localSequenceNumber?d=this.dialogState.localSequenceNumber+=1:d=this.dialogState.localSequenceNumber=1;const c=this.remoteTarget,l=this.routeSet,g=t&&t.extraHeaders,f=t&&t.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,n,s,{callId:o,cseq:d,fromTag:a,toTag:i,routeSet:l},g,f)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===K.ACK?!0:this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(e,{statusCode:500}),!1):!0}}class Zt extends us{constructor(e,t,s){super(e,t,s,k.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),Ne.TIMER_B),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(e){const t=e.toTag;if(!t)throw new Error("To tag undefined.");const s="z9hG4bK"+Math.floor(Math.random()*1e7);e.setViaHeader(s,this.transport.protocol),this.ackRetransmissionCache.set(t,e),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send ACK to 2xx response.")})}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case k.Calling:if(t>=100&&t<=199){this.stateTransition(k.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(k.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(k.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case k.Proceeding:if(t>=100&&t<=199){this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(k.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(k.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case k.Accepted:if(t>=200&&t<=299){if(!this.ackRetransmissionCache.has(e.toTag)){this.ackRetransmissionCache.set(e.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(e);return}const i=this.ackRetransmissionCache.get(e.toTag);if(i){this.send(i.toString()).catch(n=>{this.logTransportError(n,"Failed to send retransmission of ACK to 2xx response.")});return}return}break;case k.Completed:if(t>=300&&t<=699){this.ack(e);return}break;case k.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const s=`Received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(s)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(k.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(e){const t=this.request.ruri,s=this.request.callId,i=this.request.cseq,n=this.request.getHeader("from"),a=e.getHeader("to"),o=this.request.getHeader("via"),d=this.request.getHeader("route");if(!n)throw new Error("From undefined.");if(!a)throw new Error("To undefined.");if(!o)throw new Error("Via undefined.");let c=`ACK ${t} SIP/2.0\r
|
|
182
182
|
`;d&&(c+=`Route: ${d}\r
|
|
183
183
|
`),c+=`Via: ${o}\r
|
|
184
184
|
`,c+=`To: ${a}\r
|
|
@@ -188,7 +188,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
188
188
|
`,c+=`Max-Forwards: 70\r
|
|
189
189
|
`,c+=`Content-Length: 0\r
|
|
190
190
|
\r
|
|
191
|
-
`,this.send(c).catch(l=>{this.logTransportError(l,"Failed to send ACK to non-2xx response.")})}stateTransition(e,t=!1){const s=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case k.Calling:s();break;case k.Proceeding:this.state!==k.Calling&&s();break;case k.Accepted:case k.Completed:this.state!==k.Calling&&this.state!==k.Proceeding&&s();break;case k.Terminated:this.state!==k.Calling&&this.state!==k.Accepted&&this.state!==k.Completed&&(t||s());break;default:s()}this.B&&(clearTimeout(this.B),this.B=void 0),k.Proceeding,e===k.Completed&&(this.D=setTimeout(()=>this.timerD(),$e.TIMER_D)),e===k.Accepted&&(this.M=setTimeout(()=>this.timerM(),$e.TIMER_M)),e===k.Terminated&&this.dispose(),this.setState(e)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===k.Calling&&(this.onRequestTimeout(),this.stateTransition(k.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===k.Completed&&this.stateTransition(k.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===k.Accepted&&this.stateTransition(k.Terminated)}}class Ue{constructor(e,t,s,i){this.transactionConstructor=e,this.core=t,this.message=s,this.delegate=i,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("sip.user-agent-client"),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}cancel(e,t={}){if(!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");const s=this.core.makeOutgoingRequestMessage(z.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},t.extraHeaders);return s.branch=this.message.branch,this.message.headers.Route&&(s.headers.Route=this.message.headers.Route),e&&s.setHeader("Reason",e),this.transaction.state===k.Proceeding?new Ue(Qe,this.core,s):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===k.Proceeding&&new Ue(Qe,this.core,s)},{once:!0}),s}authenticationGuard(e,t){const s=e.statusCode;if(!s)throw new Error("Response status code undefined.");if(s!==401&&s!==407)return!0;let i,n;if(s===401?(i=e.parseHeader("www-authenticate"),n="authorization"):(i=e.parseHeader("proxy-authenticate"),n="proxy-authorization"),!i)return this.logger.warn(s+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||i.stale!==!0))return this.logger.warn(s+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,i))return!0;this.challenged=!0,i.stale&&(this.stale=!0);let a=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),a=this.message.cseq=t.localSequenceNumber),this.message.setHeader("cseq",a+" "+this.message.method),this.message.setHeader(n,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");const e=new Gt;e.statusCode=408,e.reasonPhrase="Request Timeout",this.receiveResponse(e)}onTransportError(e){this.logger.error(e.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");const t=new Gt;t.statusCode=503,t.reasonPhrase="Service Unavailable",this.receiveResponse(t)}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e});break;case/^2[0-9]{2}$/.test(t):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e});break;case/^3[0-9]{2}$/.test(t):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}init(){const e={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:i=>{i===k.Terminated&&(this.core.userAgentClients.delete(s),t===this._transaction&&this.dispose())},onTransportError:i=>this.onTransportError(i),receiveResponse:i=>this.receiveResponse(i)},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const s=t.id+t.request.method;this.core.userAgentClients.set(s,this)}}class Q0 extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(z.BYE,s);super(Qe,e.userAgentCore,i,t),e.dispose()}}class et extends Pa{constructor(e,t,s){super(e,t,s,k.Trying,"sip.transaction.nist")}dispose(){this.J&&(clearTimeout(this.J),this.J=void 0),super.dispose()}get kind(){return"nist"}receiveRequest(e){switch(this.state){case k.Trying:break;case k.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of provisional response.")});break;case k.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of final response.")});break;case k.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);if(e>100&&e<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case k.Trying:if(this.lastResponse=t,e>=100&&e<200){this.stateTransition(k.Proceeding),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send provisional response.")});return}if(e>=200&&e<=699){this.stateTransition(k.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case k.Proceeding:if(this.lastResponse=t,e>=200&&e<=699){this.stateTransition(k.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case k.Completed:return;case k.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const s=`Non-INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(s),new Error(s)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(k.Terminated,!0)}typeToString(){return"non-INVITE server transaction"}stateTransition(e,t=!1){const s=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case k.Trying:s();break;case k.Proceeding:this.state!==k.Trying&&s();break;case k.Completed:this.state!==k.Trying&&this.state!==k.Proceeding&&s();break;case k.Terminated:this.state!==k.Proceeding&&this.state!==k.Completed&&(t||s());break;default:s()}e===k.Completed&&(this.J=setTimeout(()=>this.timerJ(),$e.TIMER_J)),e===k.Terminated&&this.dispose(),this.setState(e)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===k.Completed&&this.stateTransition(k.Terminated)}}class bt{constructor(e,t,s,i){this.transactionConstructor=e,this.core=t,this.message=s,this.delegate=i,this.logger=this.loggerFactory.getLogger("sip.user-agent-server"),this.toTag=s.toTag?s.toTag:ls(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}accept(e={statusCode:200}){if(!this.acceptable)throw new Vt(`${this.message.method} not acceptable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<200||t>299)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}progress(e={statusCode:180}){if(!this.progressable)throw new Vt(`${this.message.method} not progressable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<101||t>199)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}redirect(e,t={statusCode:302}){if(!this.redirectable)throw new Vt(`${this.message.method} not redirectable in state ${this.transaction.state}.`);const s=t.statusCode;if(s<300||s>399)throw new TypeError(`Invalid statusCode: ${s}`);const i=new Array;return e.forEach(a=>i.push(`Contact: ${a.toString()}`)),t.extraHeaders=(t.extraHeaders||[]).concat(i),this.reply(t)}reject(e={statusCode:480}){if(!this.rejectable)throw new Vt(`${this.message.method} not rejectable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<400||t>699)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}trying(e){if(!this.tryingable)throw new Vt(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)}get acceptable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding||this.transaction.state===k.Accepted;if(this.transaction instanceof et)return this.transaction.state===k.Trying||this.transaction.state===k.Proceeding;throw new Error("Unknown transaction type.")}get progressable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding;if(this.transaction instanceof et)return!1;throw new Error("Unknown transaction type.")}get redirectable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding;if(this.transaction instanceof et)return this.transaction.state===k.Trying||this.transaction.state===k.Proceeding;throw new Error("Unknown transaction type.")}get rejectable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding;if(this.transaction instanceof et)return this.transaction.state===k.Trying||this.transaction.state===k.Proceeding;throw new Error("Unknown transaction type.")}get tryingable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding;if(this.transaction instanceof et)return this.transaction.state===k.Trying;throw new Error("Unknown transaction type.")}reply(e){!e.toTag&&e.statusCode!==100&&(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;const t=Ba(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t}init(){const e={loggerFactory:this.loggerFactory,onStateChange:i=>{i===k.Terminated&&(this.core.userAgentServers.delete(s),this.dispose())},onTransportError:i=>{this.logger.error(i.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(i):this.logger.error("User agent server response transport error.")}},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const s=t.id;this.core.userAgentServers.set(t.id,this)}}class ec extends bt{constructor(e,t,s){super(et,e.userAgentCore,t,s)}}class tc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(z.INFO,s);super(Qe,e.userAgentCore,i,t)}}class rc extends bt{constructor(e,t,s){super(et,e.userAgentCore,t,s)}}class Ha extends Ue{constructor(e,t,s){super(Qe,e,t,s)}}class $a extends bt{constructor(e,t,s){super(et,e,t,s)}}class sc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(z.NOTIFY,s);super(Qe,e.userAgentCore,i,t)}}function ic(r){return r.userAgentCore!==void 0}class fs extends bt{constructor(e,t,s){const i=ic(e)?e.userAgentCore:e;super(et,i,t,s)}}class nc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(z.PRACK,s);super(Qe,e.userAgentCore,i,t),e.signalingStateTransition(i)}}class ac extends bt{constructor(e,t,s){super(et,e.userAgentCore,t,s),e.signalingStateTransition(t),this.dialog=e}accept(e={statusCode:200}){return e.body&&this.dialog.signalingStateTransition(e.body),super.accept(e)}}class oc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(z.INVITE,s);super(Zt,e.userAgentCore,i,t),this.delegate=t,e.signalingStateTransition(i),e.reinviteUserAgentClient=this,this.dialog=e}receiveResponse(e){if(!this.authenticationGuard(e,this.dialog))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:this.dialog,prack:s=>{throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(t):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:s=>this.dialog.ack(s)});break;case/^3[0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}}class cc extends bt{constructor(e,t,s){super(Ke,e.userAgentCore,t,s),e.reinviteUserAgentServer=this,this.dialog=e}accept(e={statusCode:200}){e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(this.dialog.routeSet.map(n=>`Record-Route: ${n}`));const t=super.accept(e),s=this.dialog,i=Object.assign(Object.assign({},t),{session:s});return e.body&&this.dialog.signalingStateTransition(e.body),this.dialog.reConfirm(),i}progress(e={statusCode:180}){const t=super.progress(e),s=this.dialog,i=Object.assign(Object.assign({},t),{session:s});return e.body&&this.dialog.signalingStateTransition(e.body),i}redirect(e,t={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")}reject(e={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(e)}}class lc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(z.REFER,s);super(Qe,e.userAgentCore,i,t)}}function dc(r){return r.userAgentCore!==void 0}class Na extends bt{constructor(e,t,s){const i=dc(e)?e.userAgentCore:e;super(et,i,t,s)}}class gs extends Er{constructor(e,t,s,i){super(t,s),this.initialTransaction=e,this._signalingState=L.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=i,e instanceof Ke&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(e.request),this.logger=t.loggerFactory.getLogger("sip.invite-dialog"),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=L.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?st.Early:this.ackWait?st.AckWait:this._signalingState===L.Closed?st.Terminated:st.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(e={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let t;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof Zt))throw new Error("Transaction not instance of InviteClientTransaction.");t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof Zt))throw new Error("Initial transaction not instance of InviteClientTransaction.");t=this.initialTransaction}const s=this.createOutgoingRequestMessage(z.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(s),this.signalingStateTransition(s),{message:s}}bye(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof Ke){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==k.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new Q0(this,e,t)}info(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw new Error("Dialog not confirmed.");return new tc(this,e,t)}invite(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new oc(this,e,t)}message(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw new Error("Dialog not confirmed.");const s=this.createOutgoingRequestMessage(z.MESSAGE,t);return new Ha(this.core,s,e)}notify(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw new Error("Dialog not confirmed.");return new sc(this,e,t)}prack(e,t){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new nc(this,e,t)}refer(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw new Error("Dialog not confirmed.");return new lc(this,e,t)}receiveRequest(e){if(this.logger.log(`INVITE dialog ${this.id} received ${e.method} request`),e.method===z.ACK){if(this.ackWait){if(this.initialTransaction instanceof Zt){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(e),this.delegate&&this.delegate.onAck){const t=this.delegate.onAck({message:e});t instanceof Promise&&(this.ackProcessing=!0,t.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(e)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${e.method} request.`);return}if(super.receiveRequest(e),e.method===z.INVITE){const t=()=>{const n=this.ackWait?"waiting for initial ACK":"processing initial ACK";this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${n}`);let a="RFC 5407 suggests the following to avoid this race condition... ";a+=" Note: Implementation issues are outside the scope of this document,",a+=" but the following tip is provided for avoiding race conditions of",a+=" this type. The caller can delay sending re-INVITE F6 for some period",a+=" of time (2 seconds, perhaps), after which the caller can reasonably",a+=" assume that its ACK has been received. Implementors can decouple the",a+=" actions of the user (e.g., pressing the hold button) from the actions",a+=" of the protocol (the sending of re-INVITE F6), so that the UA can",a+=" behave like this. In this case, it is the implementor's choice as to",a+=" how long to wait. In most cases, such an implementation may be",a+=" useful to prevent the type of race condition shown in this section.",a+=" This document expresses no preference about whether or not they",a+=" should wait for an ACK to be delivered. After considering the impact",a+=" on user experience, implementors should decide whether or not to wait",a+=" for a while, because the user experience depends on the",a+=" implementation and has no direct bearing on protocol behavior.",this.logger.warn(a)},i=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.ackWait&&this.signalingState!==L.Stable){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.reinviteUserAgentServer){this.core.replyStateless(e,{statusCode:500,extraHeaders:i});return}if(this.reinviteUserAgentClient){this.core.replyStateless(e,{statusCode:491});return}}if(e.method===z.INVITE){const t=e.parseHeader("contact");if(!t)throw new Error("Contact undefined.");if(!(t instanceof ze))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=t.uri}switch(e.method){case z.BYE:{const t=new ec(this,e);this.delegate&&this.delegate.onBye?this.delegate.onBye(t):t.accept(),this.dispose()}break;case z.INFO:{const t=new rc(this,e);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(t):t.reject({statusCode:469,extraHeaders:["Recv-Info:"]})}break;case z.INVITE:{const t=new cc(this,e);this.signalingStateTransition(e),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(t):t.reject({statusCode:488})}break;case z.MESSAGE:{const t=new $a(this.core,e);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case z.NOTIFY:{const t=new fs(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(t):t.accept()}break;case z.PRACK:{const t=new ac(this,e);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(t):t.accept()}break;case z.REFER:{const t=new Na(this,e);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):t.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}reliableSequenceGuard(e){const t=e.statusCode;if(!t)throw new Error("Status code undefined");if(t>100&&t<200){const s=e.getHeader("require"),i=e.getHeader("rseq"),n=s&&s.includes("100rel")&&i?Number(i):void 0;if(n){if(this.rseq&&this.rseq+1!==n)return!1;this.rseq=this.rseq?this.rseq+1:n}}return!0}signalingStateRollback(){(this._signalingState===L.HaveLocalOffer||this.signalingState===L.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=L.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(e){const t=Ur(e);if(!(!t||t.contentDisposition!=="session")){if(this._signalingState===L.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof wr)switch(this._signalingState){case L.Initial:case L.Stable:this._signalingState=L.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case L.HaveLocalOffer:this._signalingState=L.Stable,this._answer=t;break;case L.HaveRemoteOffer:break;case L.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof Gt)switch(this._signalingState){case L.Initial:case L.Stable:this._signalingState=L.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case L.HaveLocalOffer:this._signalingState=L.Stable,this._answer=t;break;case L.HaveRemoteOffer:break;case L.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof cr)switch(this._signalingState){case L.Initial:case L.Stable:this._signalingState=L.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case L.HaveLocalOffer:break;case L.HaveRemoteOffer:this._signalingState=L.Stable,this._answer=t;break;case L.Closed:break;default:throw new Error("Unexpected signaling state.")}if(Sa(e))switch(this._signalingState){case L.Initial:case L.Stable:this._signalingState=L.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case L.HaveLocalOffer:break;case L.HaveRemoteOffer:this._signalingState=L.Stable,this._answer=t;break;case L.Closed:break;default:throw new Error("Unexpected signaling state.")}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof Ke){const e=this.initialTransaction;let t=$e.T1;const s=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,$e.T2),this.invite2xxTimer=setTimeout(s,t)};this.invite2xxTimer=setTimeout(s,t);const i=()=>{e.state===k.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};e.addStateChangeListener(i)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof Ke){const e=this.reinviteUserAgentServer.transaction;let t=$e.T1;const s=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,$e.T2),this.invite2xxTimer=setTimeout(s,t)};this.invite2xxTimer=setTimeout(s,t);const i=()=>{e.state===k.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.reinviteUserAgentServer)};e.addStateChangeListener(i)}}}class hc extends Ue{constructor(e,t,s){super(Zt,e,t,s),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=s}dispose(){this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(e){if(this.transaction.state===k.Calling)return super.onTransportError(e);this.logger.error(e.message),this.logger.error("User agent client request transport error while sending ACK.")}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});return;case/^1[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");return}const i=Er.initialDialogStateForUserAgentClient(this.message,e);let n=this.earlyDialogs.get(i.id);if(!n){const o=this.transaction;if(!(o instanceof Zt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new gs(o,this.core,i),this.earlyDialogs.set(n.id,n)}if(!n.reliableSequenceGuard(e)){this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");return}(n.signalingState===L.Initial||n.signalingState===L.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:a,prack:o=>a.prack(void 0,o)})}return;case/^2[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.error("2xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("2xx INVITE response received without a Contact header field, dropping.");return}const i=Er.initialDialogStateForUserAgentClient(this.message,e);let n=this.confirmedDialogs.get(i.id);if(n){const o=this.confirmedDialogAcks.get(i.id);if(o){const d=this.transaction;if(!(d instanceof Zt))throw new Error("Client transaction not instance of InviteClientTransaction.");d.ackResponse(o.message)}return}if(n=this.earlyDialogs.get(i.id),n)n.confirm(),n.recomputeRouteSet(e),this.earlyDialogs.delete(n.id),this.confirmedDialogs.set(n.id,n);else{const o=this.transaction;if(!(o instanceof Zt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new gs(o,this.core,i),this.confirmedDialogs.set(n.id,n)}(n.signalingState===L.Initial||n.signalingState===L.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:a,ack:o=>{const d=a.ack(o);return this.confirmedDialogAcks.set(a.id,d),d}});else{const o=a.ack();this.confirmedDialogAcks.set(a.id,o)}}return;case/^3[0-9]{2}$/.test(t):this.earlyDialogs.forEach(s=>s.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});return;case/^[4-6][0-9]{2}$/.test(t):this.earlyDialogs.forEach(s=>s.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});return;default:throw new Error(`Invalid status code ${t}`)}}}class qi extends bt{constructor(e,t,s){super(Ke,e,t,s),this.core=e}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(e={statusCode:200}){if(!this.acceptable)throw new Vt(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{const d=this.transaction;if(!(d instanceof Ke))throw new Error("Transaction not instance of InviteClientTransaction.");const c=Er.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new gs(d,this.core,c)}const t=this.message.getHeaders("record-route").map(d=>`Record-Route: ${d}`),s=`Contact: ${this.core.configuration.contact.toString()}`,i="Allow: "+zt.toString();if(!e.body){if(this.confirmedDialog.signalingState===L.Stable)e.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===L.Initial||this.confirmedDialog.signalingState===L.HaveRemoteOffer)throw new Error("Response must have a body.")}e.statusCode=e.statusCode||200,e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(i),e.extraHeaders.push(s);const n=super.accept(e),a=this.confirmedDialog,o=Object.assign(Object.assign({},n),{session:a});return e.body&&this.confirmedDialog.signalingState!==L.Stable&&this.confirmedDialog.signalingStateTransition(e.body),o}progress(e={statusCode:180}){if(!this.progressable)throw new Vt(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){const o=this.transaction;if(!(o instanceof Ke))throw new Error("Transaction not instance of InviteClientTransaction.");const d=Er.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new gs(o,this.core,d)}const t=this.message.getHeaders("record-route").map(o=>`Record-Route: ${o}`),s=`Contact: ${this.core.configuration.contact}`;e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(s);const i=super.progress(e),n=this.earlyDialog,a=Object.assign(Object.assign({},i),{session:n});return e.body&&this.earlyDialog.signalingState!==L.Stable&&this.earlyDialog.signalingStateTransition(e.body),a}redirect(e,t={statusCode:302}){return super.redirect(e,t)}reject(e={statusCode:486}){return super.reject(e)}}class uc extends Ue{constructor(e,t,s){super(Qe,e,t,s)}}class fc extends Ue{constructor(e,t,s){super(Qe,e,t,s)}}class gc extends bt{constructor(e,t,s){super(et,e,t,s),this.core=e}}class xc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(z.SUBSCRIBE,s);super(Qe,e.userAgentCore,i,t),this.dialog=e}waitNotifyStop(){}receiveResponse(e){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const s=Number(t);this.dialog.subscriptionExpires>s&&(this.dialog.subscriptionExpires=s)}}e.statusCode&&e.statusCode>=400&&e.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(e.statusCode)&&this.dialog.terminate(),super.receiveResponse(e)}}class Oa extends Er{constructor(e,t,s,i,n,a){super(i,n),this.delegate=a,this._autoRefresh=!1,this._subscriptionEvent=e,this._subscriptionExpires=t,this._subscriptionExpiresInitial=t,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=s,this.logger=i.loggerFactory.getLogger("sip.subscribe-dialog"),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(e,t){const i=t.getHeaders("record-route"),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof ze))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,d=void 0,c=e.callId,l=e.fromTag,g=t.fromTag;if(!c)throw new Error("Call id undefined.");if(!l)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,y=e.to.uri;return{id:c+l+g,early:!1,callId:c,localTag:l,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:d,localURI:u,remoteURI:y,remoteTarget:a,routeSet:i,secure:!1}}dispose(){super.dispose(),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(e){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){const e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)}set subscriptionExpires(e){if(e<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){const t=this.subscriptionRefresh;(t===void 0||t>=e)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;const e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(e){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${e.method} request`),!this.sequenceGuard(e)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${e.method} request.`);return}switch(super.receiveRequest(e),e.method){case z.NOTIFY:this.onNotify(e);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}refresh(){const e="Allow: "+zt.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}subscribe(e,t={}){var s;if(this.subscriptionState!==fe.Pending&&this.subscriptionState!==fe.Active)throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);const i=new xc(this,e,t);return this.N&&(clearTimeout(this.N),this.N=void 0),!((s=t.extraHeaders)===null||s===void 0)&&s.includes("Expires: 0")||(this.N=setTimeout(()=>this.timerN(),$e.TIMER_N)),i}terminate(){this.stateTransition(fe.Terminated),this.onTerminated()}unsubscribe(){const e="Allow: "+zt.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: 0"),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}onNotify(e){const t=e.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.core.replyStateless(e,{statusCode:489});return}this.N&&(clearTimeout(this.N),this.N=void 0);const s=e.parseHeader("Subscription-State");if(!s||!s.state){this.core.replyStateless(e,{statusCode:489});return}const i=s.state,n=s.expires?Math.max(s.expires,0):void 0;switch(i){case"pending":this.stateTransition(fe.Pending,n);break;case"active":this.stateTransition(fe.Active,n);break;case"terminated":this.stateTransition(fe.Terminated,n);break;default:this.logger.warn("Unrecognized subscription state.");break}const a=new fs(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(a):a.accept()}onRefresh(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){const e=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(e/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},e)}}stateTransition(e,t){const s=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${e}`)};switch(e){case fe.Initial:s();return;case fe.NotifyWait:s();return;case fe.Pending:if(this.subscriptionState!==fe.NotifyWait&&this.subscriptionState!==fe.Pending){s();return}break;case fe.Active:if(this.subscriptionState!==fe.NotifyWait&&this.subscriptionState!==fe.Pending&&this.subscriptionState!==fe.Active){s();return}break;case fe.Terminated:if(this.subscriptionState!==fe.NotifyWait&&this.subscriptionState!==fe.Pending&&this.subscriptionState!==fe.Active){s();return}break;default:s();return}e===fe.Pending&&t&&(this.subscriptionExpires=t),e===fe.Active&&t&&(this.subscriptionExpires=t),e===fe.Terminated&&this.dispose(),this._subscriptionState=e}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==fe.Terminated&&(this.stateTransition(fe.Terminated),this.onTerminated())}}class pc extends Ue{constructor(e,t,s){const i=t.getHeader("Event");if(!i)throw new Error("Event undefined");const n=t.getHeader("Expires");if(!n)throw new Error("Expires undefined");super(Qe,e,t,s),this.delegate=s,this.subscriberId=t.callId+t.fromTag+i,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(n),this.subscriptionEvent=i,this.subscriptionState=fe.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(e){const t=e.message.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.logger.warn("Failed to parse event."),e.reject({statusCode:489});return}const s=e.message.parseHeader("Subscription-State");if(!s||!s.state){this.logger.warn("Failed to parse subscription state."),e.reject({statusCode:489});return}const i=s.state;switch(i){case"pending":break;case"active":break;case"terminated":break;default:this.logger.warn(`Invalid subscription state ${i}`),e.reject({statusCode:489});return}if(i!=="terminated"&&!e.message.parseHeader("contact")){this.logger.warn("Failed to parse contact."),e.reject({statusCode:489});return}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=s.expires?Math.min(this.subscriptionExpires,Math.max(s.expires,0)):this.subscriptionExpires,i){case"pending":this.subscriptionState=fe.Pending;break;case"active":this.subscriptionState=fe.Active;break;case"terminated":this.subscriptionState=fe.Terminated;break;default:throw new Error(`Unrecognized state ${i}.`)}if(this.subscriptionState!==fe.Terminated){const n=Oa.initialDialogStateForSubscription(this.message,e.message);this.dialog=new Oa(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,n)}if(this.delegate&&this.delegate.onNotify){const n=e,a=this.dialog;this.delegate.onNotify({request:n,subscription:a})}else e.accept()}waitNotifyStart(){this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout(()=>this.timerN(),$e.TIMER_N))}waitNotifyStop(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)}receiveResponse(e){if(this.authenticationGuard(e)){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const s=Number(t);s>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),s<this.subscriptionExpires&&(this.subscriptionExpires=s)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}e.statusCode&&e.statusCode>=300&&e.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(e)}}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()}}class mc extends bt{constructor(e,t,s){super(et,e,t,s),this.core=e}}const Ma=["application/sdp","application/dtmf-relay"];class vc{constructor(e,t={}){this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=e,this.delegate=t,this.dialogs=new Map,this.subscribers=new Map,this.logger=e.loggerFactory.getLogger("sip.user-agent-core")}dispose(){this.reset()}reset(){this.dialogs.forEach(e=>e.dispose()),this.dialogs.clear(),this.subscribers.forEach(e=>e.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(e=>e.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(e=>e.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){const e=this.configuration.transportAccessor();if(!e)throw new Error("Transport undefined.");return e}invite(e,t){return new hc(this,e,t)}message(e,t){return new Ha(this,e,t)}publish(e,t){return new uc(this,e,t)}register(e,t){return new fc(this,e,t)}subscribe(e,t){return new pc(this,e,t)}request(e,t){return new Ue(Qe,this,e,t)}makeOutgoingRequestMessage(e,t,s,i,n,a,o){const d=this.configuration.sipjsId,c=this.configuration.displayName,l=this.configuration.viaForceRport,g=this.configuration.hackViaTcp,u=this.configuration.supportedOptionTags.slice();e===z.REGISTER&&u.push("path","gruu"),e===z.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&u.push("gruu");const y=this.configuration.routeSet,w=this.configuration.userAgentHeaderFieldValue,b=this.configuration.viaHost,x=Object.assign(Object.assign({},{callIdPrefix:d,forceRport:l,fromDisplayName:c,hackViaTcp:g,optionTags:u,routeSet:y,userAgentString:w,viaHost:b}),n);return new cr(e,t,s,i,x,a,o)}receiveIncomingRequestFromTransport(e){this.receiveRequestFromTransport(e)}receiveIncomingResponseFromTransport(e){this.receiveResponseFromTransport(e)}replyStateless(e,t){const s=this.configuration.userAgentHeaderFieldValue,i=this.configuration.supportedOptionTagsResponse;t=Object.assign(Object.assign({},t),{userAgent:s,supported:i});const n=Ba(e,t);return this.transport.send(n.message).catch(a=>{a instanceof Error&&this.logger.error(a.message),this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`)}),n}receiveRequestFromTransport(e){const t=e.viaBranch,s=this.userAgentServers.get(t);if(e.method===z.ACK&&s&&s.transaction.state===k.Accepted&&s instanceof qi){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`);return}if(e.method===z.CANCEL){s?(this.replyStateless(e,{statusCode:200}),s.transaction instanceof Ke&&s.transaction.state===k.Proceeding&&s instanceof qi&&s.receiveCancel(e)):this.replyStateless(e,{statusCode:481});return}if(s){s.transaction.receiveRequest(e);return}this.receiveRequest(e)}receiveRequest(e){if(!zt.includes(e.method)){const i="Allow: "+zt.toString();this.replyStateless(e,{statusCode:405,extraHeaders:[i]});return}if(!e.ruri)throw new Error("Request-URI undefined.");if(e.ruri.scheme!=="sip"){this.replyStateless(e,{statusCode:416});return}const t=e.ruri,s=i=>!!i&&i.user===t.user;if(!s(this.configuration.aor)&&!(s(this.configuration.contact.uri)||s(this.configuration.contact.pubGruu)||s(this.configuration.contact.tempGruu))){this.logger.warn("Request-URI does not point to us."),e.method!==z.ACK&&this.replyStateless(e,{statusCode:404});return}if(e.method===z.INVITE&&!e.hasHeader("Contact")){this.replyStateless(e,{statusCode:400,reasonPhrase:"Missing Contact Header"});return}if(!e.toTag){const i=e.viaBranch;if(!this.userAgentServers.has(i)&&Array.from(this.userAgentServers.values()).some(a=>a.transaction.request.fromTag===e.fromTag&&a.transaction.request.callId===e.callId&&a.transaction.request.cseq===e.cseq)){this.replyStateless(e,{statusCode:482});return}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}receiveInsideDialogRequest(e){if(e.method===z.NOTIFY){const i=e.parseHeader("Event");if(!i||!i.event){this.replyStateless(e,{statusCode:489});return}const n=e.callId+e.toTag+i.event,a=this.subscribers.get(n);if(a){const o=new fs(this,e);a.onNotify(o);return}}const t=e.callId+e.toTag+e.fromTag,s=this.dialogs.get(t);if(s){if(e.method===z.OPTIONS){const i="Allow: "+zt.toString(),n="Accept: "+Ma.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[i,n]});return}s.receiveRequest(e);return}e.method!==z.ACK&&this.replyStateless(e,{statusCode:481})}receiveOutsideDialogRequest(e){switch(e.method){case z.ACK:break;case z.BYE:this.replyStateless(e,{statusCode:481});break;case z.CANCEL:throw new Error(`Unexpected out of dialog request method ${e.method}.`);case z.INFO:this.replyStateless(e,{statusCode:405});break;case z.INVITE:{const t=new qi(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject()}break;case z.MESSAGE:{const t=new $a(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case z.NOTIFY:{const t=new fs(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405})}break;case z.OPTIONS:{const t="Allow: "+zt.toString(),s="Accept: "+Ma.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,s]})}break;case z.REFER:{const t=new Na(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405})}break;case z.REGISTER:{const t=new gc(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405})}break;case z.SUBSCRIBE:{const t=new mc(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480})}break;default:throw new Error(`Unexpected out of dialog request method ${e.method}.`)}}receiveResponseFromTransport(e){if(e.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response, dropping");return}const t=e.viaBranch+e.method,s=this.userAgentClients.get(t);s?s.transaction.receiveResponse(e):this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`)}}function yc(){return r=>!r.audio&&!r.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,r)}function wc(){return{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}}class Bt{constructor(e,t,s){e.debug("SessionDescriptionHandler.constructor"),this.logger=e,this.mediaStreamFactory=t,this.sessionDescriptionHandlerConfiguration=s,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(s==null?void 0:s.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(e){this._peerConnectionDelegate=e}static dispatchAddTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:t}))}static dispatchRemoveTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:t}))}close(){this.logger.debug("SessionDescriptionHandler.close"),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(e=>{e.track&&e.track.stop()}),this._peerConnection.getSenders().forEach(e=>{e.track&&e.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getReceivers().forEach(s=>{s.track&&(s.track.enabled=e)})}enableSenderTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getSenders().forEach(s=>{s.track&&(s.track.enabled=e)})}getDescription(e,t){var s,i;if(this.logger.debug("SessionDescriptionHandler.getDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=e==null?void 0:e.onDataChannel;const n=(s=e==null?void 0:e.offerOptions)===null||s===void 0?void 0:s.iceRestart,a=(e==null?void 0:e.iceGatheringTimeout)===void 0?(i=this.sessionDescriptionHandlerConfiguration)===null||i===void 0?void 0:i.iceGatheringTimeout:e==null?void 0:e.iceGatheringTimeout;return this.getLocalMediaStream(e).then(()=>this.updateDirection(e)).then(()=>this.createDataChannel(e)).then(()=>this.createLocalOfferOrAnswer(e)).then(o=>this.applyModifiers(o,t)).then(o=>this.setLocalSessionDescription(o)).then(()=>this.waitForIceGatheringComplete(n,a)).then(()=>this.getLocalSessionDescription()).then(o=>({body:o.sdp,contentType:"application/sdp"})).catch(o=>{throw this.logger.error("SessionDescriptionHandler.getDescription failed - "+o),o})}hasDescription(e){return this.logger.debug("SessionDescriptionHandler.hasDescription"),e==="application/sdp"}iceGatheringComplete(){this.logger.debug("SessionDescriptionHandler.iceGatheringComplete"),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(e,t){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),this._peerConnection===void 0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;const s=this._peerConnection.getSenders();if(s.length===0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;const i=s[0].dtmf;if(!i)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;const n=t==null?void 0:t.duration,a=t==null?void 0:t.interToneGap;try{i.insertDTMF(e,n,a)}catch(o){return this.logger.error(o.toString()),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+e.toString()),!0}setDescription(e,t,s){if(this.logger.debug("SessionDescriptionHandler.setDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=t==null?void 0:t.onDataChannel;const i=this._peerConnection.signalingState==="have-local-offer"?"answer":"offer";return this.getLocalMediaStream(t).then(()=>this.applyModifiers({sdp:e,type:i},s)).then(n=>this.setRemoteSessionDescription(n)).catch(n=>{throw this.logger.error("SessionDescriptionHandler.setDescription failed - "+n),n})}applyModifiers(e,t){return this.logger.debug("SessionDescriptionHandler.applyModifiers"),!t||t.length===0?Promise.resolve(e):t.reduce((s,i)=>s.then(i),Promise.resolve(e)).then(s=>{if(this.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!s.sdp||!s.type)throw new Error("Invalid SDP.");return{sdp:s.sdp,type:s.type}})}createDataChannel(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));if((e==null?void 0:e.dataChannel)!==!0||this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((e==null?void 0:e.dataChannelLabel)||"",e==null?void 0:e.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(t){return Promise.reject(t)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(e==null?void 0:e.offerOptions);case"have-remote-offer":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(e==null?void 0:e.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}getLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.getLocalMediaStream"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));let t=Object.assign({},e==null?void 0:e.constraints);if(this.localMediaStreamConstraints){if(t.audio=t.audio||this.localMediaStreamConstraints.audio,t.video=t.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(t.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(t.video))return Promise.resolve()}else t.audio===void 0&&t.video===void 0&&(t={audio:!0});return this.localMediaStreamConstraints=t,this.mediaStreamFactory(t,this,e).then(s=>this.setLocalMediaStream(s))}setLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");const t=this._peerConnection,s=this._localMediaStream,i=[],n=d=>{const c=d.kind;if(c!=="audio"&&c!=="video")throw new Error(`Unknown new track kind ${c}.`);const l=t.getSenders().find(g=>g.track&&g.track.kind===c);l?i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${c} track`),g()}).then(()=>l.replaceTrack(d).then(()=>{const g=s.getTracks().find(u=>u.kind===c);g&&(g.stop(),s.removeTrack(g),Bt.dispatchRemoveTrackEvent(s,g)),s.addTrack(d),Bt.dispatchAddTrackEvent(s,d)}).catch(g=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${c} track`),g}))):i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${c} track`),g()}).then(()=>{try{t.addTrack(d,s)}catch(g){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${c} track`),g}s.addTrack(d),Bt.dispatchAddTrackEvent(s,d)}))},a=e.getAudioTracks();a.length&&n(a[0]);const o=e.getVideoTracks();return o.length&&n(o[0]),i.reduce((d,c)=>d.then(()=>c),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(new Error("Failed to get local session description"))}setLocalSessionDescription(e){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),this._peerConnection===void 0?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(e)}setRemoteSessionDescription(e){if(this.logger.debug("SessionDescriptionHandler.setRemoteSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const t=e.sdp;let s;switch(this._peerConnection.signalingState){case"stable":s="offer";break;case"have-local-offer":s="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return t?this._peerConnection.setRemoteDescription({sdp:t,type:s}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))}setRemoteTrack(e){this.logger.debug("SessionDescriptionHandler.setRemoteTrack");const t=this._remoteMediaStream;t.getTrackById(e.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${e.kind} track`):e.kind==="audio"?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getAudioTracks().forEach(s=>{s.stop(),t.removeTrack(s),Bt.dispatchRemoveTrackEvent(t,s)}),t.addTrack(e),Bt.dispatchAddTrackEvent(t,e)):e.kind==="video"&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getVideoTracks().forEach(s=>{s.stop(),t.removeTrack(s),Bt.dispatchRemoveTrackEvent(t,s)}),t.addTrack(e),Bt.dispatchAddTrackEvent(t,e))}updateDirection(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.updateDirection - setting offer direction");{const t=s=>{switch(s){case"inactive":return e!=null&&e.hold?"inactive":"recvonly";case"recvonly":return e!=null&&e.hold?"inactive":"recvonly";case"sendonly":return e!=null&&e.hold?"sendonly":"sendrecv";case"sendrecv":return e!=null&&e.hold?"sendonly":"sendrecv";case"stopped":return"stopped";default:throw new Error("Should never happen")}};this._peerConnection.getTransceivers().forEach(s=>{if(s.direction){const i=t(s.direction);s.direction!==i&&(s.direction=i)}})}break;case"have-remote-offer":this.logger.debug("SessionDescriptionHandler.updateDirection - setting answer direction");{const t=(()=>{const i=this._peerConnection.remoteDescription;if(!i)throw new Error("Failed to read remote offer");const n=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(i.sdp);if(n)switch(n[0]){case`a=inactive\r
|
|
191
|
+
`,this.send(c).catch(l=>{this.logTransportError(l,"Failed to send ACK to non-2xx response.")})}stateTransition(e,t=!1){const s=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case k.Calling:s();break;case k.Proceeding:this.state!==k.Calling&&s();break;case k.Accepted:case k.Completed:this.state!==k.Calling&&this.state!==k.Proceeding&&s();break;case k.Terminated:this.state!==k.Calling&&this.state!==k.Accepted&&this.state!==k.Completed&&(t||s());break;default:s()}this.B&&(clearTimeout(this.B),this.B=void 0),k.Proceeding,e===k.Completed&&(this.D=setTimeout(()=>this.timerD(),Ne.TIMER_D)),e===k.Accepted&&(this.M=setTimeout(()=>this.timerM(),Ne.TIMER_M)),e===k.Terminated&&this.dispose(),this.setState(e)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===k.Calling&&(this.onRequestTimeout(),this.stateTransition(k.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===k.Completed&&this.stateTransition(k.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===k.Accepted&&this.stateTransition(k.Terminated)}}class Ue{constructor(e,t,s,i){this.transactionConstructor=e,this.core=t,this.message=s,this.delegate=i,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("sip.user-agent-client"),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}cancel(e,t={}){if(!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");const s=this.core.makeOutgoingRequestMessage(K.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},t.extraHeaders);return s.branch=this.message.branch,this.message.headers.Route&&(s.headers.Route=this.message.headers.Route),e&&s.setHeader("Reason",e),this.transaction.state===k.Proceeding?new Ue(Qe,this.core,s):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===k.Proceeding&&new Ue(Qe,this.core,s)},{once:!0}),s}authenticationGuard(e,t){const s=e.statusCode;if(!s)throw new Error("Response status code undefined.");if(s!==401&&s!==407)return!0;let i,n;if(s===401?(i=e.parseHeader("www-authenticate"),n="authorization"):(i=e.parseHeader("proxy-authenticate"),n="proxy-authorization"),!i)return this.logger.warn(s+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||i.stale!==!0))return this.logger.warn(s+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,i))return!0;this.challenged=!0,i.stale&&(this.stale=!0);let a=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),a=this.message.cseq=t.localSequenceNumber),this.message.setHeader("cseq",a+" "+this.message.method),this.message.setHeader(n,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");const e=new Gt;e.statusCode=408,e.reasonPhrase="Request Timeout",this.receiveResponse(e)}onTransportError(e){this.logger.error(e.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");const t=new Gt;t.statusCode=503,t.reasonPhrase="Service Unavailable",this.receiveResponse(t)}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e});break;case/^2[0-9]{2}$/.test(t):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e});break;case/^3[0-9]{2}$/.test(t):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}init(){const e={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:i=>{i===k.Terminated&&(this.core.userAgentClients.delete(s),t===this._transaction&&this.dispose())},onTransportError:i=>this.onTransportError(i),receiveResponse:i=>this.receiveResponse(i)},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const s=t.id+t.request.method;this.core.userAgentClients.set(s,this)}}class Q0 extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(K.BYE,s);super(Qe,e.userAgentCore,i,t),e.dispose()}}class et extends Ha{constructor(e,t,s){super(e,t,s,k.Trying,"sip.transaction.nist")}dispose(){this.J&&(clearTimeout(this.J),this.J=void 0),super.dispose()}get kind(){return"nist"}receiveRequest(e){switch(this.state){case k.Trying:break;case k.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of provisional response.")});break;case k.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of final response.")});break;case k.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);if(e>100&&e<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case k.Trying:if(this.lastResponse=t,e>=100&&e<200){this.stateTransition(k.Proceeding),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send provisional response.")});return}if(e>=200&&e<=699){this.stateTransition(k.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case k.Proceeding:if(this.lastResponse=t,e>=200&&e<=699){this.stateTransition(k.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case k.Completed:return;case k.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const s=`Non-INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(s),new Error(s)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(k.Terminated,!0)}typeToString(){return"non-INVITE server transaction"}stateTransition(e,t=!1){const s=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case k.Trying:s();break;case k.Proceeding:this.state!==k.Trying&&s();break;case k.Completed:this.state!==k.Trying&&this.state!==k.Proceeding&&s();break;case k.Terminated:this.state!==k.Proceeding&&this.state!==k.Completed&&(t||s());break;default:s()}e===k.Completed&&(this.J=setTimeout(()=>this.timerJ(),Ne.TIMER_J)),e===k.Terminated&&this.dispose(),this.setState(e)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===k.Completed&&this.stateTransition(k.Terminated)}}class bt{constructor(e,t,s,i){this.transactionConstructor=e,this.core=t,this.message=s,this.delegate=i,this.logger=this.loggerFactory.getLogger("sip.user-agent-server"),this.toTag=s.toTag?s.toTag:ls(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}accept(e={statusCode:200}){if(!this.acceptable)throw new Vt(`${this.message.method} not acceptable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<200||t>299)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}progress(e={statusCode:180}){if(!this.progressable)throw new Vt(`${this.message.method} not progressable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<101||t>199)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}redirect(e,t={statusCode:302}){if(!this.redirectable)throw new Vt(`${this.message.method} not redirectable in state ${this.transaction.state}.`);const s=t.statusCode;if(s<300||s>399)throw new TypeError(`Invalid statusCode: ${s}`);const i=new Array;return e.forEach(a=>i.push(`Contact: ${a.toString()}`)),t.extraHeaders=(t.extraHeaders||[]).concat(i),this.reply(t)}reject(e={statusCode:480}){if(!this.rejectable)throw new Vt(`${this.message.method} not rejectable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<400||t>699)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}trying(e){if(!this.tryingable)throw new Vt(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)}get acceptable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding||this.transaction.state===k.Accepted;if(this.transaction instanceof et)return this.transaction.state===k.Trying||this.transaction.state===k.Proceeding;throw new Error("Unknown transaction type.")}get progressable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding;if(this.transaction instanceof et)return!1;throw new Error("Unknown transaction type.")}get redirectable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding;if(this.transaction instanceof et)return this.transaction.state===k.Trying||this.transaction.state===k.Proceeding;throw new Error("Unknown transaction type.")}get rejectable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding;if(this.transaction instanceof et)return this.transaction.state===k.Trying||this.transaction.state===k.Proceeding;throw new Error("Unknown transaction type.")}get tryingable(){if(this.transaction instanceof Ke)return this.transaction.state===k.Proceeding;if(this.transaction instanceof et)return this.transaction.state===k.Trying;throw new Error("Unknown transaction type.")}reply(e){!e.toTag&&e.statusCode!==100&&(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;const t=Ba(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t}init(){const e={loggerFactory:this.loggerFactory,onStateChange:i=>{i===k.Terminated&&(this.core.userAgentServers.delete(s),this.dispose())},onTransportError:i=>{this.logger.error(i.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(i):this.logger.error("User agent server response transport error.")}},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const s=t.id;this.core.userAgentServers.set(t.id,this)}}class ec extends bt{constructor(e,t,s){super(et,e.userAgentCore,t,s)}}class tc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(K.INFO,s);super(Qe,e.userAgentCore,i,t)}}class rc extends bt{constructor(e,t,s){super(et,e.userAgentCore,t,s)}}class Pa extends Ue{constructor(e,t,s){super(Qe,e,t,s)}}class $a extends bt{constructor(e,t,s){super(et,e,t,s)}}class sc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(K.NOTIFY,s);super(Qe,e.userAgentCore,i,t)}}function ic(r){return r.userAgentCore!==void 0}class fs extends bt{constructor(e,t,s){const i=ic(e)?e.userAgentCore:e;super(et,i,t,s)}}class nc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(K.PRACK,s);super(Qe,e.userAgentCore,i,t),e.signalingStateTransition(i)}}class ac extends bt{constructor(e,t,s){super(et,e.userAgentCore,t,s),e.signalingStateTransition(t),this.dialog=e}accept(e={statusCode:200}){return e.body&&this.dialog.signalingStateTransition(e.body),super.accept(e)}}class oc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(K.INVITE,s);super(Zt,e.userAgentCore,i,t),this.delegate=t,e.signalingStateTransition(i),e.reinviteUserAgentClient=this,this.dialog=e}receiveResponse(e){if(!this.authenticationGuard(e,this.dialog))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:this.dialog,prack:s=>{throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(t):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:s=>this.dialog.ack(s)});break;case/^3[0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}}class cc extends bt{constructor(e,t,s){super(Ke,e.userAgentCore,t,s),e.reinviteUserAgentServer=this,this.dialog=e}accept(e={statusCode:200}){e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(this.dialog.routeSet.map(n=>`Record-Route: ${n}`));const t=super.accept(e),s=this.dialog,i=Object.assign(Object.assign({},t),{session:s});return e.body&&this.dialog.signalingStateTransition(e.body),this.dialog.reConfirm(),i}progress(e={statusCode:180}){const t=super.progress(e),s=this.dialog,i=Object.assign(Object.assign({},t),{session:s});return e.body&&this.dialog.signalingStateTransition(e.body),i}redirect(e,t={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")}reject(e={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(e)}}class lc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(K.REFER,s);super(Qe,e.userAgentCore,i,t)}}function dc(r){return r.userAgentCore!==void 0}class Na extends bt{constructor(e,t,s){const i=dc(e)?e.userAgentCore:e;super(et,i,t,s)}}class gs extends Er{constructor(e,t,s,i){super(t,s),this.initialTransaction=e,this._signalingState=Y.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=i,e instanceof Ke&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(e.request),this.logger=t.loggerFactory.getLogger("sip.invite-dialog"),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=Y.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?st.Early:this.ackWait?st.AckWait:this._signalingState===Y.Closed?st.Terminated:st.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(e={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let t;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof Zt))throw new Error("Transaction not instance of InviteClientTransaction.");t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof Zt))throw new Error("Initial transaction not instance of InviteClientTransaction.");t=this.initialTransaction}const s=this.createOutgoingRequestMessage(K.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(s),this.signalingStateTransition(s),{message:s}}bye(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof Ke){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==k.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new Q0(this,e,t)}info(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw new Error("Dialog not confirmed.");return new tc(this,e,t)}invite(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new oc(this,e,t)}message(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw new Error("Dialog not confirmed.");const s=this.createOutgoingRequestMessage(K.MESSAGE,t);return new Pa(this.core,s,e)}notify(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw new Error("Dialog not confirmed.");return new sc(this,e,t)}prack(e,t){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new nc(this,e,t)}refer(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw new Error("Dialog not confirmed.");return new lc(this,e,t)}receiveRequest(e){if(this.logger.log(`INVITE dialog ${this.id} received ${e.method} request`),e.method===K.ACK){if(this.ackWait){if(this.initialTransaction instanceof Zt){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(e),this.delegate&&this.delegate.onAck){const t=this.delegate.onAck({message:e});t instanceof Promise&&(this.ackProcessing=!0,t.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(e)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${e.method} request.`);return}if(super.receiveRequest(e),e.method===K.INVITE){const t=()=>{const n=this.ackWait?"waiting for initial ACK":"processing initial ACK";this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${n}`);let a="RFC 5407 suggests the following to avoid this race condition... ";a+=" Note: Implementation issues are outside the scope of this document,",a+=" but the following tip is provided for avoiding race conditions of",a+=" this type. The caller can delay sending re-INVITE F6 for some period",a+=" of time (2 seconds, perhaps), after which the caller can reasonably",a+=" assume that its ACK has been received. Implementors can decouple the",a+=" actions of the user (e.g., pressing the hold button) from the actions",a+=" of the protocol (the sending of re-INVITE F6), so that the UA can",a+=" behave like this. In this case, it is the implementor's choice as to",a+=" how long to wait. In most cases, such an implementation may be",a+=" useful to prevent the type of race condition shown in this section.",a+=" This document expresses no preference about whether or not they",a+=" should wait for an ACK to be delivered. After considering the impact",a+=" on user experience, implementors should decide whether or not to wait",a+=" for a while, because the user experience depends on the",a+=" implementation and has no direct bearing on protocol behavior.",this.logger.warn(a)},i=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.ackWait&&this.signalingState!==Y.Stable){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.reinviteUserAgentServer){this.core.replyStateless(e,{statusCode:500,extraHeaders:i});return}if(this.reinviteUserAgentClient){this.core.replyStateless(e,{statusCode:491});return}}if(e.method===K.INVITE){const t=e.parseHeader("contact");if(!t)throw new Error("Contact undefined.");if(!(t instanceof ze))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=t.uri}switch(e.method){case K.BYE:{const t=new ec(this,e);this.delegate&&this.delegate.onBye?this.delegate.onBye(t):t.accept(),this.dispose()}break;case K.INFO:{const t=new rc(this,e);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(t):t.reject({statusCode:469,extraHeaders:["Recv-Info:"]})}break;case K.INVITE:{const t=new cc(this,e);this.signalingStateTransition(e),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(t):t.reject({statusCode:488})}break;case K.MESSAGE:{const t=new $a(this.core,e);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case K.NOTIFY:{const t=new fs(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(t):t.accept()}break;case K.PRACK:{const t=new ac(this,e);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(t):t.accept()}break;case K.REFER:{const t=new Na(this,e);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):t.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}reliableSequenceGuard(e){const t=e.statusCode;if(!t)throw new Error("Status code undefined");if(t>100&&t<200){const s=e.getHeader("require"),i=e.getHeader("rseq"),n=s&&s.includes("100rel")&&i?Number(i):void 0;if(n){if(this.rseq&&this.rseq+1!==n)return!1;this.rseq=this.rseq?this.rseq+1:n}}return!0}signalingStateRollback(){(this._signalingState===Y.HaveLocalOffer||this.signalingState===Y.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=Y.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(e){const t=Ur(e);if(!(!t||t.contentDisposition!=="session")){if(this._signalingState===Y.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof wr)switch(this._signalingState){case Y.Initial:case Y.Stable:this._signalingState=Y.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case Y.HaveLocalOffer:this._signalingState=Y.Stable,this._answer=t;break;case Y.HaveRemoteOffer:break;case Y.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof Gt)switch(this._signalingState){case Y.Initial:case Y.Stable:this._signalingState=Y.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case Y.HaveLocalOffer:this._signalingState=Y.Stable,this._answer=t;break;case Y.HaveRemoteOffer:break;case Y.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof cr)switch(this._signalingState){case Y.Initial:case Y.Stable:this._signalingState=Y.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case Y.HaveLocalOffer:break;case Y.HaveRemoteOffer:this._signalingState=Y.Stable,this._answer=t;break;case Y.Closed:break;default:throw new Error("Unexpected signaling state.")}if(Sa(e))switch(this._signalingState){case Y.Initial:case Y.Stable:this._signalingState=Y.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case Y.HaveLocalOffer:break;case Y.HaveRemoteOffer:this._signalingState=Y.Stable,this._answer=t;break;case Y.Closed:break;default:throw new Error("Unexpected signaling state.")}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof Ke){const e=this.initialTransaction;let t=Ne.T1;const s=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,Ne.T2),this.invite2xxTimer=setTimeout(s,t)};this.invite2xxTimer=setTimeout(s,t);const i=()=>{e.state===k.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};e.addStateChangeListener(i)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof Ke){const e=this.reinviteUserAgentServer.transaction;let t=Ne.T1;const s=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,Ne.T2),this.invite2xxTimer=setTimeout(s,t)};this.invite2xxTimer=setTimeout(s,t);const i=()=>{e.state===k.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.reinviteUserAgentServer)};e.addStateChangeListener(i)}}}class hc extends Ue{constructor(e,t,s){super(Zt,e,t,s),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=s}dispose(){this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(e){if(this.transaction.state===k.Calling)return super.onTransportError(e);this.logger.error(e.message),this.logger.error("User agent client request transport error while sending ACK.")}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});return;case/^1[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");return}const i=Er.initialDialogStateForUserAgentClient(this.message,e);let n=this.earlyDialogs.get(i.id);if(!n){const o=this.transaction;if(!(o instanceof Zt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new gs(o,this.core,i),this.earlyDialogs.set(n.id,n)}if(!n.reliableSequenceGuard(e)){this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");return}(n.signalingState===Y.Initial||n.signalingState===Y.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:a,prack:o=>a.prack(void 0,o)})}return;case/^2[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.error("2xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("2xx INVITE response received without a Contact header field, dropping.");return}const i=Er.initialDialogStateForUserAgentClient(this.message,e);let n=this.confirmedDialogs.get(i.id);if(n){const o=this.confirmedDialogAcks.get(i.id);if(o){const d=this.transaction;if(!(d instanceof Zt))throw new Error("Client transaction not instance of InviteClientTransaction.");d.ackResponse(o.message)}return}if(n=this.earlyDialogs.get(i.id),n)n.confirm(),n.recomputeRouteSet(e),this.earlyDialogs.delete(n.id),this.confirmedDialogs.set(n.id,n);else{const o=this.transaction;if(!(o instanceof Zt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new gs(o,this.core,i),this.confirmedDialogs.set(n.id,n)}(n.signalingState===Y.Initial||n.signalingState===Y.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:a,ack:o=>{const d=a.ack(o);return this.confirmedDialogAcks.set(a.id,d),d}});else{const o=a.ack();this.confirmedDialogAcks.set(a.id,o)}}return;case/^3[0-9]{2}$/.test(t):this.earlyDialogs.forEach(s=>s.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});return;case/^[4-6][0-9]{2}$/.test(t):this.earlyDialogs.forEach(s=>s.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});return;default:throw new Error(`Invalid status code ${t}`)}}}class qi extends bt{constructor(e,t,s){super(Ke,e,t,s),this.core=e}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(e={statusCode:200}){if(!this.acceptable)throw new Vt(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{const d=this.transaction;if(!(d instanceof Ke))throw new Error("Transaction not instance of InviteClientTransaction.");const c=Er.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new gs(d,this.core,c)}const t=this.message.getHeaders("record-route").map(d=>`Record-Route: ${d}`),s=`Contact: ${this.core.configuration.contact.toString()}`,i="Allow: "+zt.toString();if(!e.body){if(this.confirmedDialog.signalingState===Y.Stable)e.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===Y.Initial||this.confirmedDialog.signalingState===Y.HaveRemoteOffer)throw new Error("Response must have a body.")}e.statusCode=e.statusCode||200,e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(i),e.extraHeaders.push(s);const n=super.accept(e),a=this.confirmedDialog,o=Object.assign(Object.assign({},n),{session:a});return e.body&&this.confirmedDialog.signalingState!==Y.Stable&&this.confirmedDialog.signalingStateTransition(e.body),o}progress(e={statusCode:180}){if(!this.progressable)throw new Vt(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){const o=this.transaction;if(!(o instanceof Ke))throw new Error("Transaction not instance of InviteClientTransaction.");const d=Er.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new gs(o,this.core,d)}const t=this.message.getHeaders("record-route").map(o=>`Record-Route: ${o}`),s=`Contact: ${this.core.configuration.contact}`;e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(s);const i=super.progress(e),n=this.earlyDialog,a=Object.assign(Object.assign({},i),{session:n});return e.body&&this.earlyDialog.signalingState!==Y.Stable&&this.earlyDialog.signalingStateTransition(e.body),a}redirect(e,t={statusCode:302}){return super.redirect(e,t)}reject(e={statusCode:486}){return super.reject(e)}}class uc extends Ue{constructor(e,t,s){super(Qe,e,t,s)}}class fc extends Ue{constructor(e,t,s){super(Qe,e,t,s)}}class gc extends bt{constructor(e,t,s){super(et,e,t,s),this.core=e}}class xc extends Ue{constructor(e,t,s){const i=e.createOutgoingRequestMessage(K.SUBSCRIBE,s);super(Qe,e.userAgentCore,i,t),this.dialog=e}waitNotifyStop(){}receiveResponse(e){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const s=Number(t);this.dialog.subscriptionExpires>s&&(this.dialog.subscriptionExpires=s)}}e.statusCode&&e.statusCode>=400&&e.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(e.statusCode)&&this.dialog.terminate(),super.receiveResponse(e)}}class Oa extends Er{constructor(e,t,s,i,n,a){super(i,n),this.delegate=a,this._autoRefresh=!1,this._subscriptionEvent=e,this._subscriptionExpires=t,this._subscriptionExpiresInitial=t,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=s,this.logger=i.loggerFactory.getLogger("sip.subscribe-dialog"),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(e,t){const i=t.getHeaders("record-route"),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof ze))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,d=void 0,c=e.callId,l=e.fromTag,g=t.fromTag;if(!c)throw new Error("Call id undefined.");if(!l)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const f=e.from.uri,w=e.to.uri;return{id:c+l+g,early:!1,callId:c,localTag:l,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:d,localURI:f,remoteURI:w,remoteTarget:a,routeSet:i,secure:!1}}dispose(){super.dispose(),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(e){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){const e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)}set subscriptionExpires(e){if(e<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){const t=this.subscriptionRefresh;(t===void 0||t>=e)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;const e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(e){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${e.method} request`),!this.sequenceGuard(e)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${e.method} request.`);return}switch(super.receiveRequest(e),e.method){case K.NOTIFY:this.onNotify(e);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}refresh(){const e="Allow: "+zt.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}subscribe(e,t={}){var s;if(this.subscriptionState!==fe.Pending&&this.subscriptionState!==fe.Active)throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);const i=new xc(this,e,t);return this.N&&(clearTimeout(this.N),this.N=void 0),!((s=t.extraHeaders)===null||s===void 0)&&s.includes("Expires: 0")||(this.N=setTimeout(()=>this.timerN(),Ne.TIMER_N)),i}terminate(){this.stateTransition(fe.Terminated),this.onTerminated()}unsubscribe(){const e="Allow: "+zt.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: 0"),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}onNotify(e){const t=e.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.core.replyStateless(e,{statusCode:489});return}this.N&&(clearTimeout(this.N),this.N=void 0);const s=e.parseHeader("Subscription-State");if(!s||!s.state){this.core.replyStateless(e,{statusCode:489});return}const i=s.state,n=s.expires?Math.max(s.expires,0):void 0;switch(i){case"pending":this.stateTransition(fe.Pending,n);break;case"active":this.stateTransition(fe.Active,n);break;case"terminated":this.stateTransition(fe.Terminated,n);break;default:this.logger.warn("Unrecognized subscription state.");break}const a=new fs(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(a):a.accept()}onRefresh(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){const e=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(e/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},e)}}stateTransition(e,t){const s=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${e}`)};switch(e){case fe.Initial:s();return;case fe.NotifyWait:s();return;case fe.Pending:if(this.subscriptionState!==fe.NotifyWait&&this.subscriptionState!==fe.Pending){s();return}break;case fe.Active:if(this.subscriptionState!==fe.NotifyWait&&this.subscriptionState!==fe.Pending&&this.subscriptionState!==fe.Active){s();return}break;case fe.Terminated:if(this.subscriptionState!==fe.NotifyWait&&this.subscriptionState!==fe.Pending&&this.subscriptionState!==fe.Active){s();return}break;default:s();return}e===fe.Pending&&t&&(this.subscriptionExpires=t),e===fe.Active&&t&&(this.subscriptionExpires=t),e===fe.Terminated&&this.dispose(),this._subscriptionState=e}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==fe.Terminated&&(this.stateTransition(fe.Terminated),this.onTerminated())}}class pc extends Ue{constructor(e,t,s){const i=t.getHeader("Event");if(!i)throw new Error("Event undefined");const n=t.getHeader("Expires");if(!n)throw new Error("Expires undefined");super(Qe,e,t,s),this.delegate=s,this.subscriberId=t.callId+t.fromTag+i,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(n),this.subscriptionEvent=i,this.subscriptionState=fe.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(e){const t=e.message.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.logger.warn("Failed to parse event."),e.reject({statusCode:489});return}const s=e.message.parseHeader("Subscription-State");if(!s||!s.state){this.logger.warn("Failed to parse subscription state."),e.reject({statusCode:489});return}const i=s.state;switch(i){case"pending":break;case"active":break;case"terminated":break;default:this.logger.warn(`Invalid subscription state ${i}`),e.reject({statusCode:489});return}if(i!=="terminated"&&!e.message.parseHeader("contact")){this.logger.warn("Failed to parse contact."),e.reject({statusCode:489});return}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=s.expires?Math.min(this.subscriptionExpires,Math.max(s.expires,0)):this.subscriptionExpires,i){case"pending":this.subscriptionState=fe.Pending;break;case"active":this.subscriptionState=fe.Active;break;case"terminated":this.subscriptionState=fe.Terminated;break;default:throw new Error(`Unrecognized state ${i}.`)}if(this.subscriptionState!==fe.Terminated){const n=Oa.initialDialogStateForSubscription(this.message,e.message);this.dialog=new Oa(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,n)}if(this.delegate&&this.delegate.onNotify){const n=e,a=this.dialog;this.delegate.onNotify({request:n,subscription:a})}else e.accept()}waitNotifyStart(){this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout(()=>this.timerN(),Ne.TIMER_N))}waitNotifyStop(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)}receiveResponse(e){if(this.authenticationGuard(e)){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const s=Number(t);s>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),s<this.subscriptionExpires&&(this.subscriptionExpires=s)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}e.statusCode&&e.statusCode>=300&&e.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(e)}}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()}}class mc extends bt{constructor(e,t,s){super(et,e,t,s),this.core=e}}const Ma=["application/sdp","application/dtmf-relay"];class vc{constructor(e,t={}){this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=e,this.delegate=t,this.dialogs=new Map,this.subscribers=new Map,this.logger=e.loggerFactory.getLogger("sip.user-agent-core")}dispose(){this.reset()}reset(){this.dialogs.forEach(e=>e.dispose()),this.dialogs.clear(),this.subscribers.forEach(e=>e.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(e=>e.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(e=>e.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){const e=this.configuration.transportAccessor();if(!e)throw new Error("Transport undefined.");return e}invite(e,t){return new hc(this,e,t)}message(e,t){return new Pa(this,e,t)}publish(e,t){return new uc(this,e,t)}register(e,t){return new fc(this,e,t)}subscribe(e,t){return new pc(this,e,t)}request(e,t){return new Ue(Qe,this,e,t)}makeOutgoingRequestMessage(e,t,s,i,n,a,o){const d=this.configuration.sipjsId,c=this.configuration.displayName,l=this.configuration.viaForceRport,g=this.configuration.hackViaTcp,f=this.configuration.supportedOptionTags.slice();e===K.REGISTER&&f.push("path","gruu"),e===K.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&f.push("gruu");const w=this.configuration.routeSet,y=this.configuration.userAgentHeaderFieldValue,b=this.configuration.viaHost,x=Object.assign(Object.assign({},{callIdPrefix:d,forceRport:l,fromDisplayName:c,hackViaTcp:g,optionTags:f,routeSet:w,userAgentString:y,viaHost:b}),n);return new cr(e,t,s,i,x,a,o)}receiveIncomingRequestFromTransport(e){this.receiveRequestFromTransport(e)}receiveIncomingResponseFromTransport(e){this.receiveResponseFromTransport(e)}replyStateless(e,t){const s=this.configuration.userAgentHeaderFieldValue,i=this.configuration.supportedOptionTagsResponse;t=Object.assign(Object.assign({},t),{userAgent:s,supported:i});const n=Ba(e,t);return this.transport.send(n.message).catch(a=>{a instanceof Error&&this.logger.error(a.message),this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`)}),n}receiveRequestFromTransport(e){const t=e.viaBranch,s=this.userAgentServers.get(t);if(e.method===K.ACK&&s&&s.transaction.state===k.Accepted&&s instanceof qi){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`);return}if(e.method===K.CANCEL){s?(this.replyStateless(e,{statusCode:200}),s.transaction instanceof Ke&&s.transaction.state===k.Proceeding&&s instanceof qi&&s.receiveCancel(e)):this.replyStateless(e,{statusCode:481});return}if(s){s.transaction.receiveRequest(e);return}this.receiveRequest(e)}receiveRequest(e){if(!zt.includes(e.method)){const i="Allow: "+zt.toString();this.replyStateless(e,{statusCode:405,extraHeaders:[i]});return}if(!e.ruri)throw new Error("Request-URI undefined.");if(e.ruri.scheme!=="sip"){this.replyStateless(e,{statusCode:416});return}const t=e.ruri,s=i=>!!i&&i.user===t.user;if(!s(this.configuration.aor)&&!(s(this.configuration.contact.uri)||s(this.configuration.contact.pubGruu)||s(this.configuration.contact.tempGruu))){this.logger.warn("Request-URI does not point to us."),e.method!==K.ACK&&this.replyStateless(e,{statusCode:404});return}if(e.method===K.INVITE&&!e.hasHeader("Contact")){this.replyStateless(e,{statusCode:400,reasonPhrase:"Missing Contact Header"});return}if(!e.toTag){const i=e.viaBranch;if(!this.userAgentServers.has(i)&&Array.from(this.userAgentServers.values()).some(a=>a.transaction.request.fromTag===e.fromTag&&a.transaction.request.callId===e.callId&&a.transaction.request.cseq===e.cseq)){this.replyStateless(e,{statusCode:482});return}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}receiveInsideDialogRequest(e){if(e.method===K.NOTIFY){const i=e.parseHeader("Event");if(!i||!i.event){this.replyStateless(e,{statusCode:489});return}const n=e.callId+e.toTag+i.event,a=this.subscribers.get(n);if(a){const o=new fs(this,e);a.onNotify(o);return}}const t=e.callId+e.toTag+e.fromTag,s=this.dialogs.get(t);if(s){if(e.method===K.OPTIONS){const i="Allow: "+zt.toString(),n="Accept: "+Ma.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[i,n]});return}s.receiveRequest(e);return}e.method!==K.ACK&&this.replyStateless(e,{statusCode:481})}receiveOutsideDialogRequest(e){switch(e.method){case K.ACK:break;case K.BYE:this.replyStateless(e,{statusCode:481});break;case K.CANCEL:throw new Error(`Unexpected out of dialog request method ${e.method}.`);case K.INFO:this.replyStateless(e,{statusCode:405});break;case K.INVITE:{const t=new qi(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject()}break;case K.MESSAGE:{const t=new $a(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case K.NOTIFY:{const t=new fs(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405})}break;case K.OPTIONS:{const t="Allow: "+zt.toString(),s="Accept: "+Ma.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,s]})}break;case K.REFER:{const t=new Na(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405})}break;case K.REGISTER:{const t=new gc(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405})}break;case K.SUBSCRIBE:{const t=new mc(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480})}break;default:throw new Error(`Unexpected out of dialog request method ${e.method}.`)}}receiveResponseFromTransport(e){if(e.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response, dropping");return}const t=e.viaBranch+e.method,s=this.userAgentClients.get(t);s?s.transaction.receiveResponse(e):this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`)}}function yc(){return r=>!r.audio&&!r.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,r)}function wc(){return{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}}class Bt{constructor(e,t,s){e.debug("SessionDescriptionHandler.constructor"),this.logger=e,this.mediaStreamFactory=t,this.sessionDescriptionHandlerConfiguration=s,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(s==null?void 0:s.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(e){this._peerConnectionDelegate=e}static dispatchAddTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:t}))}static dispatchRemoveTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:t}))}close(){this.logger.debug("SessionDescriptionHandler.close"),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(e=>{e.track&&e.track.stop()}),this._peerConnection.getSenders().forEach(e=>{e.track&&e.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getReceivers().forEach(s=>{s.track&&(s.track.enabled=e)})}enableSenderTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getSenders().forEach(s=>{s.track&&(s.track.enabled=e)})}getDescription(e,t){var s,i;if(this.logger.debug("SessionDescriptionHandler.getDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=e==null?void 0:e.onDataChannel;const n=(s=e==null?void 0:e.offerOptions)===null||s===void 0?void 0:s.iceRestart,a=(e==null?void 0:e.iceGatheringTimeout)===void 0?(i=this.sessionDescriptionHandlerConfiguration)===null||i===void 0?void 0:i.iceGatheringTimeout:e==null?void 0:e.iceGatheringTimeout;return this.getLocalMediaStream(e).then(()=>this.updateDirection(e)).then(()=>this.createDataChannel(e)).then(()=>this.createLocalOfferOrAnswer(e)).then(o=>this.applyModifiers(o,t)).then(o=>this.setLocalSessionDescription(o)).then(()=>this.waitForIceGatheringComplete(n,a)).then(()=>this.getLocalSessionDescription()).then(o=>({body:o.sdp,contentType:"application/sdp"})).catch(o=>{throw this.logger.error("SessionDescriptionHandler.getDescription failed - "+o),o})}hasDescription(e){return this.logger.debug("SessionDescriptionHandler.hasDescription"),e==="application/sdp"}iceGatheringComplete(){this.logger.debug("SessionDescriptionHandler.iceGatheringComplete"),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(e,t){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),this._peerConnection===void 0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;const s=this._peerConnection.getSenders();if(s.length===0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;const i=s[0].dtmf;if(!i)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;const n=t==null?void 0:t.duration,a=t==null?void 0:t.interToneGap;try{i.insertDTMF(e,n,a)}catch(o){return this.logger.error(o.toString()),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+e.toString()),!0}setDescription(e,t,s){if(this.logger.debug("SessionDescriptionHandler.setDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=t==null?void 0:t.onDataChannel;const i=this._peerConnection.signalingState==="have-local-offer"?"answer":"offer";return this.getLocalMediaStream(t).then(()=>this.applyModifiers({sdp:e,type:i},s)).then(n=>this.setRemoteSessionDescription(n)).catch(n=>{throw this.logger.error("SessionDescriptionHandler.setDescription failed - "+n),n})}applyModifiers(e,t){return this.logger.debug("SessionDescriptionHandler.applyModifiers"),!t||t.length===0?Promise.resolve(e):t.reduce((s,i)=>s.then(i),Promise.resolve(e)).then(s=>{if(this.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!s.sdp||!s.type)throw new Error("Invalid SDP.");return{sdp:s.sdp,type:s.type}})}createDataChannel(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));if((e==null?void 0:e.dataChannel)!==!0||this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((e==null?void 0:e.dataChannelLabel)||"",e==null?void 0:e.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(t){return Promise.reject(t)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(e==null?void 0:e.offerOptions);case"have-remote-offer":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(e==null?void 0:e.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}getLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.getLocalMediaStream"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));let t=Object.assign({},e==null?void 0:e.constraints);if(this.localMediaStreamConstraints){if(t.audio=t.audio||this.localMediaStreamConstraints.audio,t.video=t.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(t.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(t.video))return Promise.resolve()}else t.audio===void 0&&t.video===void 0&&(t={audio:!0});return this.localMediaStreamConstraints=t,this.mediaStreamFactory(t,this,e).then(s=>this.setLocalMediaStream(s))}setLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");const t=this._peerConnection,s=this._localMediaStream,i=[],n=d=>{const c=d.kind;if(c!=="audio"&&c!=="video")throw new Error(`Unknown new track kind ${c}.`);const l=t.getSenders().find(g=>g.track&&g.track.kind===c);l?i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${c} track`),g()}).then(()=>l.replaceTrack(d).then(()=>{const g=s.getTracks().find(f=>f.kind===c);g&&(g.stop(),s.removeTrack(g),Bt.dispatchRemoveTrackEvent(s,g)),s.addTrack(d),Bt.dispatchAddTrackEvent(s,d)}).catch(g=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${c} track`),g}))):i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${c} track`),g()}).then(()=>{try{t.addTrack(d,s)}catch(g){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${c} track`),g}s.addTrack(d),Bt.dispatchAddTrackEvent(s,d)}))},a=e.getAudioTracks();a.length&&n(a[0]);const o=e.getVideoTracks();return o.length&&n(o[0]),i.reduce((d,c)=>d.then(()=>c),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(new Error("Failed to get local session description"))}setLocalSessionDescription(e){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),this._peerConnection===void 0?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(e)}setRemoteSessionDescription(e){if(this.logger.debug("SessionDescriptionHandler.setRemoteSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const t=e.sdp;let s;switch(this._peerConnection.signalingState){case"stable":s="offer";break;case"have-local-offer":s="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return t?this._peerConnection.setRemoteDescription({sdp:t,type:s}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))}setRemoteTrack(e){this.logger.debug("SessionDescriptionHandler.setRemoteTrack");const t=this._remoteMediaStream;t.getTrackById(e.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${e.kind} track`):e.kind==="audio"?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getAudioTracks().forEach(s=>{s.stop(),t.removeTrack(s),Bt.dispatchRemoveTrackEvent(t,s)}),t.addTrack(e),Bt.dispatchAddTrackEvent(t,e)):e.kind==="video"&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getVideoTracks().forEach(s=>{s.stop(),t.removeTrack(s),Bt.dispatchRemoveTrackEvent(t,s)}),t.addTrack(e),Bt.dispatchAddTrackEvent(t,e))}updateDirection(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.updateDirection - setting offer direction");{const t=s=>{switch(s){case"inactive":return e!=null&&e.hold?"inactive":"recvonly";case"recvonly":return e!=null&&e.hold?"inactive":"recvonly";case"sendonly":return e!=null&&e.hold?"sendonly":"sendrecv";case"sendrecv":return e!=null&&e.hold?"sendonly":"sendrecv";case"stopped":return"stopped";default:throw new Error("Should never happen")}};this._peerConnection.getTransceivers().forEach(s=>{if(s.direction){const i=t(s.direction);s.direction!==i&&(s.direction=i)}})}break;case"have-remote-offer":this.logger.debug("SessionDescriptionHandler.updateDirection - setting answer direction");{const t=(()=>{const i=this._peerConnection.remoteDescription;if(!i)throw new Error("Failed to read remote offer");const n=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(i.sdp);if(n)switch(n[0]){case`a=inactive\r
|
|
192
192
|
`:return"inactive";case`a=recvonly\r
|
|
193
193
|
`:return"recvonly";case`a=sendonly\r
|
|
194
194
|
`:return"sendonly";case`a=sendrecv\r
|
|
@@ -203,16 +203,16 @@ React keys must be passed directly to JSX without using spread:
|
|
|
203
203
|
`+i+`
|
|
204
204
|
`);if(this.state!==ee.Connected){this.logger.warn("Received message while not connected, discarding...");return}if(this.onMessage)try{this.onMessage(i)}catch(n){throw this.logger.error(n.toString()),this.logger.error("Exception thrown by onMessage callback"),n}}onWebSocketOpen(e,t){t===this._ws&&this._state===ee.Connecting&&(this.logger.log(`WebSocket opened ${this.server}`),this.transitionState(ee.Connected))}transitionLoopDetectedError(e){let t="A state transition loop has been detected.";return t+=` An attempt to transition from ${this._state} to ${e} before the prior transition completed.`,t+=" Perhaps you are synchronously calling connect() or disconnect() from a callback or state change handler?",this.logger.error(t),new Mr("Loop detected.")}transitionState(e,t){const s=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};if(this.transitioningState)throw this.transitionLoopDetectedError(e);switch(this.transitioningState=!0,this._state){case ee.Connecting:e!==ee.Connected&&e!==ee.Disconnecting&&e!==ee.Disconnected&&s();break;case ee.Connected:e!==ee.Disconnecting&&e!==ee.Disconnected&&s();break;case ee.Disconnecting:e!==ee.Connecting&&e!==ee.Disconnected&&s();break;case ee.Disconnected:e!==ee.Connecting&&s();break;default:throw new Error("Unknown state.")}const i=this._state;this._state=e;const n=this.connectResolve,a=this.connectReject;i===ee.Connecting&&(this.connectPromise=void 0,this.connectResolve=void 0,this.connectReject=void 0);const o=this.disconnectResolve,d=this.disconnectReject;if(i===ee.Disconnecting&&(this.disconnectPromise=void 0,this.disconnectResolve=void 0,this.disconnectReject=void 0),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=void 0),this.logger.log(`Transitioned from ${i} to ${this._state}`),this._stateEventEmitter.emit(this._state),e===ee.Connected&&(this.startSendingKeepAlives(),this.onConnect))try{this.onConnect()}catch(c){throw this.logger.error(c.toString()),this.logger.error("Exception thrown by onConnect callback"),c}if(i===ee.Connected&&(this.stopSendingKeepAlives(),this.onDisconnect))try{t?this.onDisconnect(t):this.onDisconnect()}catch(c){throw this.logger.error(c.toString()),this.logger.error("Exception thrown by onDisconnect callback"),c}if(i===ee.Connecting){if(!n)throw new Error("Connect resolve undefined.");if(!a)throw new Error("Connect reject undefined.");e===ee.Connected?n():a(t||new Error("Connect aborted."))}if(i===ee.Disconnecting){if(!o)throw new Error("Disconnect resolve undefined.");if(!d)throw new Error("Disconnect reject undefined.");e===ee.Disconnected?o():d(t||new Error("Disconnect aborted."))}this.transitioningState=!1}clearKeepAliveTimeout(){this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveDebounceTimeout=void 0}sendKeepAlive(){return this.keepAliveDebounceTimeout?Promise.resolve():(this.keepAliveDebounceTimeout=setTimeout(()=>{this.clearKeepAliveTimeout()},this.configuration.keepAliveDebounce*1e3),this.send(`\r
|
|
205
205
|
\r
|
|
206
|
-
`))}startSendingKeepAlives(){const e=t=>{const s=t*.8;return 1e3*(Math.random()*(t-s)+s)};this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},e(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}}xs.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};class lr{constructor(e={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=Me.Stopped,this._stateEventEmitter=new jr,this.delegate=e.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lr.defaultOptions()),{sipjsId:or(5)}),{uri:new yt("sip","anonymous."+or(6),"anonymous.invalid")}),{viaHost:or(12)+".invalid"}),lr.stripUndefinedProperties(e)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact=="boolean"&&this.options.hackIpInContact){const i=Math.floor(Math.random()*254+1);this.options.viaHost="192.0.2."+i}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new J0,this.logger=this.loggerFactory.getLogger("sip.UserAgent"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=Ne.error;break;case"warn":this.loggerFactory.level=Ne.warn;break;case"log":this.loggerFactory.level=Ne.log;break;case"debug":this.loggerFactory.level=Ne.debug;break}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(t=>{const s=this.options[t];switch(t){case"uri":case"sessionDescriptionHandlerFactory":this.logger.log("· "+t+": "+s);break;case"authorizationPassword":this.logger.log("· "+t+": NOT SHOWN");break;case"transportConstructor":this.logger.log("· "+t+": "+s.name);break;default:this.logger.log("· "+t+": "+JSON.stringify(s))}})),this.options.transportOptions){const t=this.options.transportOptions,s=t.maxReconnectionAttempts,i=t.reconnectionTimeout;s!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),i!==void 0&&this.logger.warn('The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionDelay===void 0&&i!==void 0&&(this.options.reconnectionDelay=i),e.reconnectionAttempts===void 0&&s!==void 0&&(this.options.reconnectionAttempts=s)}if(e.reconnectionDelay!==void 0&&this.logger.warn('The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionAttempts!==void 0&&this.logger.warn('The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),this._transport=new this.options.transportConstructor(this.getLogger("sip.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:lr.newUUID(),Ie.parse(this._instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");this._userAgentCore=this.initCore()}static makeURI(e){return Ie.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",delegate:{},contactName:"",contactParams:{transport:"ws"},displayName:"",forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:"",instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:"log",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:Ec(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:ht.Unsupported,sipExtensionReplaces:ht.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:xs,transportOptions:{},uri:new yt("sip","anonymous","anonymous.invalid"),userAgentString:"SIP.js/"+O0,viaHost:""}}static newUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const s=Math.floor(Math.random()*16);return(t==="x"?s:s%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,s)=>(e[s]!==void 0&&(t[s]=e[s]),t),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,t){return this.loggerFactory.getLogger(e,t)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===Me.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===Me.Started?(this.logger.warn("User agent already started"),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(Me.Started),this.transport.connect())}async stop(){if(this.state===Me.Stopped)return this.logger.warn("User agent already stopped"),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log("Dispose of transport"),this.transport.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(Me.Stopped),Promise.resolve();const e=Object.assign({},this._publishers),t=Object.assign({},this._registerers),s=Object.assign({},this._sessions),i=Object.assign({},this._subscriptions),n=this.transport,a=this.userAgentCore;this.logger.log("Dispose of registerers");for(const o in t)t[o]&&await t[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._registerers[o],d});this.logger.log("Dispose of sessions");for(const o in s)s[o]&&await s[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._sessions[o],d});this.logger.log("Dispose of subscriptions");for(const o in i)i[o]&&await i[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._subscriptions[o],d});this.logger.log("Dispose of publishers");for(const o in e)e[o]&&await e[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._publishers[o],d});this.logger.log("Dispose of transport"),await n.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),a.dispose(),this.transitionState(Me.Stopped)}_makeInviter(e,t){return new Fa(this,e,t)}attemptReconnection(e=1){const t=this.options.reconnectionAttempts,s=this.options.reconnectionDelay;if(e>t){this.logger.log("Maximum reconnection attempts reached");return}this.logger.log(`Reconnection attempt ${e} of ${t} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${t} - succeeded`)}).catch(i=>{this.logger.error(i.message),this.logger.log(`Reconnection attempt ${e} of ${t} - failed`),this.attemptReconnection(++e)})},e===1?0:s*1e3)}initContact(){const e=this.options.contactName!==""?this.options.contactName:or(8),t=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new yt("sip",e,this.options.viaHost,void 0,t),toString:(i={})=>{const n=i.anonymous||!1,a=i.outbound||!1,o=i.register||!1;let d="<";return n?d+=this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${t.transport?t.transport:"ws"}`:o?d+=this.contact.uri:d+=this.contact.pubGruu||this.contact.uri,a&&(d+=";ob"),d+=">",this.options.instanceIdAlwaysAdded&&(d+=';+sip.instance="<urn:uuid:'+this._instanceId+'>"'),d}}}initCore(){let e=[];e.push("outbound"),this.options.sipExtension100rel===ht.Supported&&e.push("100rel"),this.options.sipExtensionReplaces===ht.Supported&&e.push("replaces"),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(n=>K0[n])),e=Array.from(new Set(e));const t=e.slice();(this.contact.pubGruu||this.contact.tempGruu)&&t.push("gruu");const s={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:t,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{const n=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,a=this.options.authorizationPassword?this.options.authorizationPassword:void 0,o=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new X0(this.getLoggerFactory(),o,n,a)},transportAccessor:()=>this.transport},i={onInvite:n=>{var a;const o=new Z0(this,n);if(n.delegate={onCancel:d=>{o._onCancel(d)},onTransportError:d=>{this.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},n.trying(),this.options.sipExtensionReplaces!==ht.Unsupported){const c=n.message.parseHeader("replaces");if(c){const l=c.call_id;if(typeof l!="string")throw new Error("Type of call id is not string");const g=c.replaces_to_tag;if(typeof g!="string")throw new Error("Type of to tag is not string");const u=c.replaces_from_tag;if(typeof u!="string")throw new Error("type of from tag is not string");const y=l+g+u,w=this.userAgentCore.dialogs.get(y);if(!w){o.reject({statusCode:481});return}if(!w.early&&c.early_only===!0){o.reject({statusCode:486});return}const b=this._sessions[l+u]||this._sessions[l+g]||void 0;if(!b)throw new Error("Session does not exist.");o._replacee=b}}if(!((a=this.delegate)===null||a===void 0)&&a.onInvite){if(o.autoSendAnInitialProvisionalResponse){o.progress().then(()=>{var d;if(((d=this.delegate)===null||d===void 0?void 0:d.onInvite)===void 0)throw new Error("onInvite undefined.");this.delegate.onInvite(o)});return}this.delegate.onInvite(o);return}o.reject({statusCode:486})},onMessage:n=>{if(this.delegate&&this.delegate.onMessage){const a=new Ra(n);this.delegate.onMessage(a)}else n.accept()},onNotify:n=>{if(this.delegate&&this.delegate.onNotify){const a=new Mi(n);this.delegate.onNotify(a)}else this.options.allowLegacyNotifications?n.accept():n.reject({statusCode:481})},onRefer:n=>{this.logger.warn("Received an out of dialog REFER request"),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(n):n.reject({statusCode:405})},onRegister:n=>{this.logger.warn("Received an out of dialog REGISTER request"),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(n):n.reject({statusCode:405})},onSubscribe:n=>{this.logger.warn("Received an out of dialog SUBSCRIBE request"),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(n):n.reject({statusCode:405})}};return new vc(s,i)}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==Me.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==Me.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){const t=hs.parseMessage(e,this.getLogger("sip.Parser"));if(!t){this.logger.warn("Failed to parse incoming message. Dropping.");return}if(this.state===Me.Stopped&&t instanceof wr){this.logger.warn(`Received ${t.method} request while stopped. Dropping.`);return}const s=()=>{const i=["from","to","call_id","cseq","via"];for(const n of i)if(!t.hasHeader(n))return this.logger.warn(`Missing mandatory header field : ${n}.`),!1;return!0};if(t instanceof wr){if(!s()){this.logger.warn("Request missing mandatory header field. Dropping.");return}if(!t.toTag&&t.callId.substr(0,5)===this.options.sipjsId){this.userAgentCore.replyStateless(t,{statusCode:482});return}const i=qr(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.userAgentCore.replyStateless(t,{statusCode:400});return}}if(t instanceof Gt){if(!s()){this.logger.warn("Response missing mandatory header field. Dropping.");return}if(t.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response. Dropping.");return}if(t.via.host!==this.options.viaHost||t.via.port!==void 0){this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");return}const i=qr(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.");return}}if(t instanceof wr){this.userAgentCore.receiveIncomingRequestFromTransport(t);return}if(t instanceof Gt){this.userAgentCore.receiveIncomingResponseFromTransport(t);return}throw new Error("Invalid message type.")}transitionState(e,t){const s=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case Me.Started:e!==Me.Stopped&&s();break;case Me.Stopped:e!==Me.Started&&s();break;default:throw new Error("Unknown state.")}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}}//! moment.js
|
|
206
|
+
`))}startSendingKeepAlives(){const e=t=>{const s=t*.8;return 1e3*(Math.random()*(t-s)+s)};this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},e(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}}xs.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};class lr{constructor(e={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=je.Stopped,this._stateEventEmitter=new jr,this.delegate=e.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},lr.defaultOptions()),{sipjsId:or(5)}),{uri:new yt("sip","anonymous."+or(6),"anonymous.invalid")}),{viaHost:or(12)+".invalid"}),lr.stripUndefinedProperties(e)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact=="boolean"&&this.options.hackIpInContact){const i=Math.floor(Math.random()*254+1);this.options.viaHost="192.0.2."+i}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new J0,this.logger=this.loggerFactory.getLogger("sip.UserAgent"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=Oe.error;break;case"warn":this.loggerFactory.level=Oe.warn;break;case"log":this.loggerFactory.level=Oe.log;break;case"debug":this.loggerFactory.level=Oe.debug;break}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(t=>{const s=this.options[t];switch(t){case"uri":case"sessionDescriptionHandlerFactory":this.logger.log("· "+t+": "+s);break;case"authorizationPassword":this.logger.log("· "+t+": NOT SHOWN");break;case"transportConstructor":this.logger.log("· "+t+": "+s.name);break;default:this.logger.log("· "+t+": "+JSON.stringify(s))}})),this.options.transportOptions){const t=this.options.transportOptions,s=t.maxReconnectionAttempts,i=t.reconnectionTimeout;s!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),i!==void 0&&this.logger.warn('The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionDelay===void 0&&i!==void 0&&(this.options.reconnectionDelay=i),e.reconnectionAttempts===void 0&&s!==void 0&&(this.options.reconnectionAttempts=s)}if(e.reconnectionDelay!==void 0&&this.logger.warn('The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionAttempts!==void 0&&this.logger.warn('The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),this._transport=new this.options.transportConstructor(this.getLogger("sip.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:lr.newUUID(),Ie.parse(this._instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");this._userAgentCore=this.initCore()}static makeURI(e){return Ie.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",delegate:{},contactName:"",contactParams:{transport:"ws"},displayName:"",forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:"",instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:"log",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:Ec(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:ht.Unsupported,sipExtensionReplaces:ht.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:xs,transportOptions:{},uri:new yt("sip","anonymous","anonymous.invalid"),userAgentString:"SIP.js/"+O0,viaHost:""}}static newUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const s=Math.floor(Math.random()*16);return(t==="x"?s:s%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,s)=>(e[s]!==void 0&&(t[s]=e[s]),t),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,t){return this.loggerFactory.getLogger(e,t)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===je.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===je.Started?(this.logger.warn("User agent already started"),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(je.Started),this.transport.connect())}async stop(){if(this.state===je.Stopped)return this.logger.warn("User agent already stopped"),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log("Dispose of transport"),this.transport.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(je.Stopped),Promise.resolve();const e=Object.assign({},this._publishers),t=Object.assign({},this._registerers),s=Object.assign({},this._sessions),i=Object.assign({},this._subscriptions),n=this.transport,a=this.userAgentCore;this.logger.log("Dispose of registerers");for(const o in t)t[o]&&await t[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._registerers[o],d});this.logger.log("Dispose of sessions");for(const o in s)s[o]&&await s[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._sessions[o],d});this.logger.log("Dispose of subscriptions");for(const o in i)i[o]&&await i[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._subscriptions[o],d});this.logger.log("Dispose of publishers");for(const o in e)e[o]&&await e[o].dispose().catch(d=>{throw this.logger.error(d.message),delete this._publishers[o],d});this.logger.log("Dispose of transport"),await n.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),a.dispose(),this.transitionState(je.Stopped)}_makeInviter(e,t){return new Fa(this,e,t)}attemptReconnection(e=1){const t=this.options.reconnectionAttempts,s=this.options.reconnectionDelay;if(e>t){this.logger.log("Maximum reconnection attempts reached");return}this.logger.log(`Reconnection attempt ${e} of ${t} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${t} - succeeded`)}).catch(i=>{this.logger.error(i.message),this.logger.log(`Reconnection attempt ${e} of ${t} - failed`),this.attemptReconnection(++e)})},e===1?0:s*1e3)}initContact(){const e=this.options.contactName!==""?this.options.contactName:or(8),t=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new yt("sip",e,this.options.viaHost,void 0,t),toString:(i={})=>{const n=i.anonymous||!1,a=i.outbound||!1,o=i.register||!1;let d="<";return n?d+=this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${t.transport?t.transport:"ws"}`:o?d+=this.contact.uri:d+=this.contact.pubGruu||this.contact.uri,a&&(d+=";ob"),d+=">",this.options.instanceIdAlwaysAdded&&(d+=';+sip.instance="<urn:uuid:'+this._instanceId+'>"'),d}}}initCore(){let e=[];e.push("outbound"),this.options.sipExtension100rel===ht.Supported&&e.push("100rel"),this.options.sipExtensionReplaces===ht.Supported&&e.push("replaces"),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(n=>K0[n])),e=Array.from(new Set(e));const t=e.slice();(this.contact.pubGruu||this.contact.tempGruu)&&t.push("gruu");const s={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:t,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{const n=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,a=this.options.authorizationPassword?this.options.authorizationPassword:void 0,o=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new X0(this.getLoggerFactory(),o,n,a)},transportAccessor:()=>this.transport},i={onInvite:n=>{var a;const o=new Z0(this,n);if(n.delegate={onCancel:d=>{o._onCancel(d)},onTransportError:d=>{this.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},n.trying(),this.options.sipExtensionReplaces!==ht.Unsupported){const c=n.message.parseHeader("replaces");if(c){const l=c.call_id;if(typeof l!="string")throw new Error("Type of call id is not string");const g=c.replaces_to_tag;if(typeof g!="string")throw new Error("Type of to tag is not string");const f=c.replaces_from_tag;if(typeof f!="string")throw new Error("type of from tag is not string");const w=l+g+f,y=this.userAgentCore.dialogs.get(w);if(!y){o.reject({statusCode:481});return}if(!y.early&&c.early_only===!0){o.reject({statusCode:486});return}const b=this._sessions[l+f]||this._sessions[l+g]||void 0;if(!b)throw new Error("Session does not exist.");o._replacee=b}}if(!((a=this.delegate)===null||a===void 0)&&a.onInvite){if(o.autoSendAnInitialProvisionalResponse){o.progress().then(()=>{var d;if(((d=this.delegate)===null||d===void 0?void 0:d.onInvite)===void 0)throw new Error("onInvite undefined.");this.delegate.onInvite(o)});return}this.delegate.onInvite(o);return}o.reject({statusCode:486})},onMessage:n=>{if(this.delegate&&this.delegate.onMessage){const a=new Ra(n);this.delegate.onMessage(a)}else n.accept()},onNotify:n=>{if(this.delegate&&this.delegate.onNotify){const a=new Mi(n);this.delegate.onNotify(a)}else this.options.allowLegacyNotifications?n.accept():n.reject({statusCode:481})},onRefer:n=>{this.logger.warn("Received an out of dialog REFER request"),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(n):n.reject({statusCode:405})},onRegister:n=>{this.logger.warn("Received an out of dialog REGISTER request"),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(n):n.reject({statusCode:405})},onSubscribe:n=>{this.logger.warn("Received an out of dialog SUBSCRIBE request"),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(n):n.reject({statusCode:405})}};return new vc(s,i)}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==je.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==je.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){const t=hs.parseMessage(e,this.getLogger("sip.Parser"));if(!t){this.logger.warn("Failed to parse incoming message. Dropping.");return}if(this.state===je.Stopped&&t instanceof wr){this.logger.warn(`Received ${t.method} request while stopped. Dropping.`);return}const s=()=>{const i=["from","to","call_id","cseq","via"];for(const n of i)if(!t.hasHeader(n))return this.logger.warn(`Missing mandatory header field : ${n}.`),!1;return!0};if(t instanceof wr){if(!s()){this.logger.warn("Request missing mandatory header field. Dropping.");return}if(!t.toTag&&t.callId.substr(0,5)===this.options.sipjsId){this.userAgentCore.replyStateless(t,{statusCode:482});return}const i=qr(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.userAgentCore.replyStateless(t,{statusCode:400});return}}if(t instanceof Gt){if(!s()){this.logger.warn("Response missing mandatory header field. Dropping.");return}if(t.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response. Dropping.");return}if(t.via.host!==this.options.viaHost||t.via.port!==void 0){this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");return}const i=qr(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.");return}}if(t instanceof wr){this.userAgentCore.receiveIncomingRequestFromTransport(t);return}if(t instanceof Gt){this.userAgentCore.receiveIncomingResponseFromTransport(t);return}throw new Error("Invalid message type.")}transitionState(e,t){const s=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case je.Started:e!==je.Stopped&&s();break;case je.Stopped:e!==je.Started&&s();break;default:throw new Error("Unknown state.")}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}}//! moment.js
|
|
207
207
|
//! version : 2.30.1
|
|
208
208
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
209
209
|
//! license : MIT
|
|
210
210
|
//! momentjs.com
|
|
211
|
-
var ja;function
|
|
211
|
+
var ja;function W(){return ja.apply(null,arguments)}function bc(r){ja=r}function ut(r){return r instanceof Array||Object.prototype.toString.call(r)==="[object Array]"}function dr(r){return r!=null&&Object.prototype.toString.call(r)==="[object Object]"}function ge(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Ui(r){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(r).length===0;var e;for(e in r)if(ge(r,e))return!1;return!0}function Ze(r){return r===void 0}function It(r){return typeof r=="number"||Object.prototype.toString.call(r)==="[object Number]"}function Yr(r){return r instanceof Date||Object.prototype.toString.call(r)==="[object Date]"}function qa(r,e){var t=[],s,i=r.length;for(s=0;s<i;++s)t.push(e(r[s],s));return t}function Xt(r,e){for(var t in e)ge(e,t)&&(r[t]=e[t]);return ge(e,"toString")&&(r.toString=e.toString),ge(e,"valueOf")&&(r.valueOf=e.valueOf),r}function Ct(r,e,t,s){return xo(r,e,t,s,!0).utc()}function Cc(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function re(r){return r._pf==null&&(r._pf=Cc()),r._pf}var Li;Array.prototype.some?Li=Array.prototype.some:Li=function(r){var e=Object(this),t=e.length>>>0,s;for(s=0;s<t;s++)if(s in e&&r.call(this,e[s],s,e))return!0;return!1};function Yi(r){var e=null,t=!1,s=r._d&&!isNaN(r._d.getTime());if(s&&(e=re(r),t=Li.call(e.parsedDateParts,function(i){return i!=null}),s=e.overflow<0&&!e.empty&&!e.invalidEra&&!e.invalidMonth&&!e.invalidWeekday&&!e.weekdayMismatch&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&t),r._strict&&(s=s&&e.charsLeftOver===0&&e.unusedTokens.length===0&&e.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(r))r._isValid=s;else return s;return r._isValid}function ps(r){var e=Ct(NaN);return r!=null?Xt(re(e),r):re(e).userInvalidated=!0,e}var Ua=W.momentProperties=[],Wi=!1;function Gi(r,e){var t,s,i,n=Ua.length;if(Ze(e._isAMomentObject)||(r._isAMomentObject=e._isAMomentObject),Ze(e._i)||(r._i=e._i),Ze(e._f)||(r._f=e._f),Ze(e._l)||(r._l=e._l),Ze(e._strict)||(r._strict=e._strict),Ze(e._tzm)||(r._tzm=e._tzm),Ze(e._isUTC)||(r._isUTC=e._isUTC),Ze(e._offset)||(r._offset=e._offset),Ze(e._pf)||(r._pf=re(e)),Ze(e._locale)||(r._locale=e._locale),n>0)for(t=0;t<n;t++)s=Ua[t],i=e[s],Ze(i)||(r[s]=i);return r}function Wr(r){Gi(this,r),this._d=new Date(r._d!=null?r._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),Wi===!1&&(Wi=!0,W.updateOffset(this),Wi=!1)}function ft(r){return r instanceof Wr||r!=null&&r._isAMomentObject!=null}function La(r){W.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+r)}function it(r,e){var t=!0;return Xt(function(){if(W.deprecationHandler!=null&&W.deprecationHandler(null,r),t){var s=[],i,n,a,o=arguments.length;for(n=0;n<o;n++){if(i="",typeof arguments[n]=="object"){i+=`
|
|
212
212
|
[`+n+"] ";for(a in arguments[0])ge(arguments[0],a)&&(i+=a+": "+arguments[0][a]+", ");i=i.slice(0,-2)}else i=arguments[n];s.push(i)}La(r+`
|
|
213
213
|
Arguments: `+Array.prototype.slice.call(s).join("")+`
|
|
214
|
-
`+new Error().stack),t=!1}return e.apply(this,arguments)},e)}var Ya={};function Wa(r,e){Y.deprecationHandler!=null&&Y.deprecationHandler(r,e),Ya[r]||(La(e),Ya[r]=!0)}Y.suppressDeprecationWarnings=!1,Y.deprecationHandler=null;function _t(r){return typeof Function<"u"&&r instanceof Function||Object.prototype.toString.call(r)==="[object Function]"}function _c(r){var e,t;for(t in r)ge(r,t)&&(e=r[t],_t(e)?this[t]=e:this["_"+t]=e);this._config=r,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Vi(r,e){var t=Xt({},r),s;for(s in e)ge(e,s)&&(dr(r[s])&&dr(e[s])?(t[s]={},Xt(t[s],r[s]),Xt(t[s],e[s])):e[s]!=null?t[s]=e[s]:delete t[s]);for(s in r)ge(r,s)&&!ge(e,s)&&dr(r[s])&&(t[s]=Xt({},t[s]));return t}function zi(r){r!=null&&this.set(r)}var Ki;Object.keys?Ki=Object.keys:Ki=function(r){var e,t=[];for(e in r)ge(r,e)&&t.push(e);return t};var Dc={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Ac(r,e,t){var s=this._calendar[r]||this._calendar.sameElse;return _t(s)?s.call(e,t):s}function Dt(r,e,t){var s=""+Math.abs(r),i=e-s.length,n=r>=0;return(n?t?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var Zi=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ms=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Xi={},br={};function J(r,e,t,s){var i=s;typeof s=="string"&&(i=function(){return this[s]()}),r&&(br[r]=i),e&&(br[e[0]]=function(){return Dt(i.apply(this,arguments),e[1],e[2])}),t&&(br[t]=function(){return this.localeData().ordinal(i.apply(this,arguments),r)})}function Sc(r){return r.match(/\[[\s\S]/)?r.replace(/^\[|\]$/g,""):r.replace(/\\/g,"")}function Tc(r){var e=r.match(Zi),t,s;for(t=0,s=e.length;t<s;t++)br[e[t]]?e[t]=br[e[t]]:e[t]=Sc(e[t]);return function(i){var n="",a;for(a=0;a<s;a++)n+=_t(e[a])?e[a].call(i,r):e[a];return n}}function vs(r,e){return r.isValid()?(e=Ga(e,r.localeData()),Xi[e]=Xi[e]||Tc(e),Xi[e](r)):r.localeData().invalidDate()}function Ga(r,e){var t=5;function s(i){return e.longDateFormat(i)||i}for(ms.lastIndex=0;t>=0&&ms.test(r);)r=r.replace(ms,s),ms.lastIndex=0,t-=1;return r}var Rc={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Fc(r){var e=this._longDateFormat[r],t=this._longDateFormat[r.toUpperCase()];return e||!t?e:(this._longDateFormat[r]=t.match(Zi).map(function(s){return s==="MMMM"||s==="MM"||s==="DD"||s==="dddd"?s.slice(1):s}).join(""),this._longDateFormat[r])}var kc="Invalid date";function Bc(){return this._invalidDate}var Ic="%d",Pc=/\d{1,2}/;function Hc(r){return this._ordinal.replace("%d",r)}var $c={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Nc(r,e,t,s){var i=this._relativeTime[t];return _t(i)?i(r,e,t,s):i.replace(/%d/i,r)}function Oc(r,e){var t=this._relativeTime[r>0?"future":"past"];return _t(t)?t(e):t.replace(/%s/i,e)}var Va={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function nt(r){return typeof r=="string"?Va[r]||Va[r.toLowerCase()]:void 0}function Ji(r){var e={},t,s;for(s in r)ge(r,s)&&(t=nt(s),t&&(e[t]=r[s]));return e}var Mc={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function jc(r){var e=[],t;for(t in r)ge(r,t)&&e.push({unit:t,priority:Mc[t]});return e.sort(function(s,i){return s.priority-i.priority}),e}var za=/\d/,tt=/\d\d/,Ka=/\d{3}/,Qi=/\d{4}/,ys=/[+-]?\d{6}/,Ce=/\d\d?/,Za=/\d\d\d\d?/,Xa=/\d\d\d\d\d\d?/,ws=/\d{1,3}/,en=/\d{1,4}/,Es=/[+-]?\d{1,6}/,Cr=/\d+/,bs=/[+-]?\d+/,qc=/Z|[+-]\d\d:?\d\d/gi,Cs=/Z|[+-]\d\d(?::?\d\d)?/gi,Uc=/[+-]?\d+(\.\d{1,3})?/,Gr=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,_r=/^[1-9]\d?/,tn=/^([1-9]\d|\d)/,_s;_s={};function Z(r,e,t){_s[r]=_t(e)?e:function(s,i){return s&&t?t:e}}function Lc(r,e){return ge(_s,r)?_s[r](e._strict,e._locale):new RegExp(Yc(r))}function Yc(r){return Pt(r.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,s,i,n){return t||s||i||n}))}function Pt(r){return r.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function at(r){return r<0?Math.ceil(r)||0:Math.floor(r)}function ae(r){var e=+r,t=0;return e!==0&&isFinite(e)&&(t=at(e)),t}var rn={};function ye(r,e){var t,s=e,i;for(typeof r=="string"&&(r=[r]),It(e)&&(s=function(n,a){a[e]=ae(n)}),i=r.length,t=0;t<i;t++)rn[r[t]]=s}function Vr(r,e){ye(r,function(t,s,i,n){i._w=i._w||{},e(t,i._w,i,n)})}function Wc(r,e,t){e!=null&&ge(rn,r)&&rn[r](e,t._a,t,r)}function Ds(r){return r%4===0&&r%100!==0||r%400===0}var Le=0,Ht=1,At=2,Pe=3,gt=4,$t=5,hr=6,Gc=7,Vc=8;J("Y",0,0,function(){var r=this.year();return r<=9999?Dt(r,4):"+"+r}),J(0,["YY",2],0,function(){return this.year()%100}),J(0,["YYYY",4],0,"year"),J(0,["YYYYY",5],0,"year"),J(0,["YYYYYY",6,!0],0,"year"),Z("Y",bs),Z("YY",Ce,tt),Z("YYYY",en,Qi),Z("YYYYY",Es,ys),Z("YYYYYY",Es,ys),ye(["YYYYY","YYYYYY"],Le),ye("YYYY",function(r,e){e[Le]=r.length===2?Y.parseTwoDigitYear(r):ae(r)}),ye("YY",function(r,e){e[Le]=Y.parseTwoDigitYear(r)}),ye("Y",function(r,e){e[Le]=parseInt(r,10)});function zr(r){return Ds(r)?366:365}Y.parseTwoDigitYear=function(r){return ae(r)+(ae(r)>68?1900:2e3)};var Ja=Dr("FullYear",!0);function zc(){return Ds(this.year())}function Dr(r,e){return function(t){return t!=null?(Qa(this,r,t),Y.updateOffset(this,e),this):Kr(this,r)}}function Kr(r,e){if(!r.isValid())return NaN;var t=r._d,s=r._isUTC;switch(e){case"Milliseconds":return s?t.getUTCMilliseconds():t.getMilliseconds();case"Seconds":return s?t.getUTCSeconds():t.getSeconds();case"Minutes":return s?t.getUTCMinutes():t.getMinutes();case"Hours":return s?t.getUTCHours():t.getHours();case"Date":return s?t.getUTCDate():t.getDate();case"Day":return s?t.getUTCDay():t.getDay();case"Month":return s?t.getUTCMonth():t.getMonth();case"FullYear":return s?t.getUTCFullYear():t.getFullYear();default:return NaN}}function Qa(r,e,t){var s,i,n,a,o;if(!(!r.isValid()||isNaN(t))){switch(s=r._d,i=r._isUTC,e){case"Milliseconds":return void(i?s.setUTCMilliseconds(t):s.setMilliseconds(t));case"Seconds":return void(i?s.setUTCSeconds(t):s.setSeconds(t));case"Minutes":return void(i?s.setUTCMinutes(t):s.setMinutes(t));case"Hours":return void(i?s.setUTCHours(t):s.setHours(t));case"Date":return void(i?s.setUTCDate(t):s.setDate(t));case"FullYear":break;default:return}n=t,a=r.month(),o=r.date(),o=o===29&&a===1&&!Ds(n)?28:o,i?s.setUTCFullYear(n,a,o):s.setFullYear(n,a,o)}}function Kc(r){return r=nt(r),_t(this[r])?this[r]():this}function Zc(r,e){if(typeof r=="object"){r=Ji(r);var t=jc(r),s,i=t.length;for(s=0;s<i;s++)this[t[s].unit](r[t[s].unit])}else if(r=nt(r),_t(this[r]))return this[r](e);return this}function Xc(r,e){return(r%e+e)%e}var Te;Array.prototype.indexOf?Te=Array.prototype.indexOf:Te=function(r){var e;for(e=0;e<this.length;++e)if(this[e]===r)return e;return-1};function sn(r,e){if(isNaN(r)||isNaN(e))return NaN;var t=Xc(e,12);return r+=(e-t)/12,t===1?Ds(r)?29:28:31-t%7%2}J("M",["MM",2],"Mo",function(){return this.month()+1}),J("MMM",0,0,function(r){return this.localeData().monthsShort(this,r)}),J("MMMM",0,0,function(r){return this.localeData().months(this,r)}),Z("M",Ce,_r),Z("MM",Ce,tt),Z("MMM",function(r,e){return e.monthsShortRegex(r)}),Z("MMMM",function(r,e){return e.monthsRegex(r)}),ye(["M","MM"],function(r,e){e[Ht]=ae(r)-1}),ye(["MMM","MMMM"],function(r,e,t,s){var i=t._locale.monthsParse(r,s,t._strict);i!=null?e[Ht]=i:re(t).invalidMonth=r});var Jc="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),eo="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),to=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Qc=Gr,el=Gr;function tl(r,e){return r?ut(this._months)?this._months[r.month()]:this._months[(this._months.isFormat||to).test(e)?"format":"standalone"][r.month()]:ut(this._months)?this._months:this._months.standalone}function rl(r,e){return r?ut(this._monthsShort)?this._monthsShort[r.month()]:this._monthsShort[to.test(e)?"format":"standalone"][r.month()]:ut(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function sl(r,e,t){var s,i,n,a=r.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)n=Ct([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(n,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(n,"").toLocaleLowerCase();return t?e==="MMM"?(i=Te.call(this._shortMonthsParse,a),i!==-1?i:null):(i=Te.call(this._longMonthsParse,a),i!==-1?i:null):e==="MMM"?(i=Te.call(this._shortMonthsParse,a),i!==-1?i:(i=Te.call(this._longMonthsParse,a),i!==-1?i:null)):(i=Te.call(this._longMonthsParse,a),i!==-1?i:(i=Te.call(this._shortMonthsParse,a),i!==-1?i:null))}function il(r,e,t){var s,i,n;if(this._monthsParseExact)return sl.call(this,r,e,t);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=Ct([2e3,s]),t&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!t&&!this._monthsParse[s]&&(n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(n.replace(".",""),"i")),t&&e==="MMMM"&&this._longMonthsParse[s].test(r))return s;if(t&&e==="MMM"&&this._shortMonthsParse[s].test(r))return s;if(!t&&this._monthsParse[s].test(r))return s}}function ro(r,e){if(!r.isValid())return r;if(typeof e=="string"){if(/^\d+$/.test(e))e=ae(e);else if(e=r.localeData().monthsParse(e),!It(e))return r}var t=e,s=r.date();return s=s<29?s:Math.min(s,sn(r.year(),t)),r._isUTC?r._d.setUTCMonth(t,s):r._d.setMonth(t,s),r}function so(r){return r!=null?(ro(this,r),Y.updateOffset(this,!0),this):Kr(this,"Month")}function nl(){return sn(this.year(),this.month())}function al(r){return this._monthsParseExact?(ge(this,"_monthsRegex")||io.call(this),r?this._monthsShortStrictRegex:this._monthsShortRegex):(ge(this,"_monthsShortRegex")||(this._monthsShortRegex=Qc),this._monthsShortStrictRegex&&r?this._monthsShortStrictRegex:this._monthsShortRegex)}function ol(r){return this._monthsParseExact?(ge(this,"_monthsRegex")||io.call(this),r?this._monthsStrictRegex:this._monthsRegex):(ge(this,"_monthsRegex")||(this._monthsRegex=el),this._monthsStrictRegex&&r?this._monthsStrictRegex:this._monthsRegex)}function io(){function r(d,c){return c.length-d.length}var e=[],t=[],s=[],i,n,a,o;for(i=0;i<12;i++)n=Ct([2e3,i]),a=Pt(this.monthsShort(n,"")),o=Pt(this.months(n,"")),e.push(a),t.push(o),s.push(o),s.push(a);e.sort(r),t.sort(r),s.sort(r),this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function cl(r,e,t,s,i,n,a){var o;return r<100&&r>=0?(o=new Date(r+400,e,t,s,i,n,a),isFinite(o.getFullYear())&&o.setFullYear(r)):o=new Date(r,e,t,s,i,n,a),o}function Zr(r){var e,t;return r<100&&r>=0?(t=Array.prototype.slice.call(arguments),t[0]=r+400,e=new Date(Date.UTC.apply(null,t)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(r)):e=new Date(Date.UTC.apply(null,arguments)),e}function As(r,e,t){var s=7+e-t,i=(7+Zr(r,0,s).getUTCDay()-e)%7;return-i+s-1}function no(r,e,t,s,i){var n=(7+t-s)%7,a=As(r,s,i),o=1+7*(e-1)+n+a,d,c;return o<=0?(d=r-1,c=zr(d)+o):o>zr(r)?(d=r+1,c=o-zr(r)):(d=r,c=o),{year:d,dayOfYear:c}}function Xr(r,e,t){var s=As(r.year(),e,t),i=Math.floor((r.dayOfYear()-s-1)/7)+1,n,a;return i<1?(a=r.year()-1,n=i+Nt(a,e,t)):i>Nt(r.year(),e,t)?(n=i-Nt(r.year(),e,t),a=r.year()+1):(a=r.year(),n=i),{week:n,year:a}}function Nt(r,e,t){var s=As(r,e,t),i=As(r+1,e,t);return(zr(r)-s+i)/7}J("w",["ww",2],"wo","week"),J("W",["WW",2],"Wo","isoWeek"),Z("w",Ce,_r),Z("ww",Ce,tt),Z("W",Ce,_r),Z("WW",Ce,tt),Vr(["w","ww","W","WW"],function(r,e,t,s){e[s.substr(0,1)]=ae(r)});function ll(r){return Xr(r,this._week.dow,this._week.doy).week}var dl={dow:0,doy:6};function hl(){return this._week.dow}function ul(){return this._week.doy}function fl(r){var e=this.localeData().week(this);return r==null?e:this.add((r-e)*7,"d")}function gl(r){var e=Xr(this,1,4).week;return r==null?e:this.add((r-e)*7,"d")}J("d",0,"do","day"),J("dd",0,0,function(r){return this.localeData().weekdaysMin(this,r)}),J("ddd",0,0,function(r){return this.localeData().weekdaysShort(this,r)}),J("dddd",0,0,function(r){return this.localeData().weekdays(this,r)}),J("e",0,0,"weekday"),J("E",0,0,"isoWeekday"),Z("d",Ce),Z("e",Ce),Z("E",Ce),Z("dd",function(r,e){return e.weekdaysMinRegex(r)}),Z("ddd",function(r,e){return e.weekdaysShortRegex(r)}),Z("dddd",function(r,e){return e.weekdaysRegex(r)}),Vr(["dd","ddd","dddd"],function(r,e,t,s){var i=t._locale.weekdaysParse(r,s,t._strict);i!=null?e.d=i:re(t).invalidWeekday=r}),Vr(["d","e","E"],function(r,e,t,s){e[s]=ae(r)});function xl(r,e){return typeof r!="string"?r:isNaN(r)?(r=e.weekdaysParse(r),typeof r=="number"?r:null):parseInt(r,10)}function pl(r,e){return typeof r=="string"?e.weekdaysParse(r)%7||7:isNaN(r)?null:r}function nn(r,e){return r.slice(e,7).concat(r.slice(0,e))}var ml="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ao="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),vl="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),yl=Gr,wl=Gr,El=Gr;function bl(r,e){var t=ut(this._weekdays)?this._weekdays:this._weekdays[r&&r!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return r===!0?nn(t,this._week.dow):r?t[r.day()]:t}function Cl(r){return r===!0?nn(this._weekdaysShort,this._week.dow):r?this._weekdaysShort[r.day()]:this._weekdaysShort}function _l(r){return r===!0?nn(this._weekdaysMin,this._week.dow):r?this._weekdaysMin[r.day()]:this._weekdaysMin}function Dl(r,e,t){var s,i,n,a=r.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)n=Ct([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(n,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(n,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(n,"").toLocaleLowerCase();return t?e==="dddd"?(i=Te.call(this._weekdaysParse,a),i!==-1?i:null):e==="ddd"?(i=Te.call(this._shortWeekdaysParse,a),i!==-1?i:null):(i=Te.call(this._minWeekdaysParse,a),i!==-1?i:null):e==="dddd"?(i=Te.call(this._weekdaysParse,a),i!==-1||(i=Te.call(this._shortWeekdaysParse,a),i!==-1)?i:(i=Te.call(this._minWeekdaysParse,a),i!==-1?i:null)):e==="ddd"?(i=Te.call(this._shortWeekdaysParse,a),i!==-1||(i=Te.call(this._weekdaysParse,a),i!==-1)?i:(i=Te.call(this._minWeekdaysParse,a),i!==-1?i:null)):(i=Te.call(this._minWeekdaysParse,a),i!==-1||(i=Te.call(this._weekdaysParse,a),i!==-1)?i:(i=Te.call(this._shortWeekdaysParse,a),i!==-1?i:null))}function Al(r,e,t){var s,i,n;if(this._weekdaysParseExact)return Dl.call(this,r,e,t);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=Ct([2e3,1]).day(s),t&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(n.replace(".",""),"i")),t&&e==="dddd"&&this._fullWeekdaysParse[s].test(r))return s;if(t&&e==="ddd"&&this._shortWeekdaysParse[s].test(r))return s;if(t&&e==="dd"&&this._minWeekdaysParse[s].test(r))return s;if(!t&&this._weekdaysParse[s].test(r))return s}}function Sl(r){if(!this.isValid())return r!=null?this:NaN;var e=Kr(this,"Day");return r!=null?(r=xl(r,this.localeData()),this.add(r-e,"d")):e}function Tl(r){if(!this.isValid())return r!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return r==null?e:this.add(r-e,"d")}function Rl(r){if(!this.isValid())return r!=null?this:NaN;if(r!=null){var e=pl(r,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function Fl(r){return this._weekdaysParseExact?(ge(this,"_weekdaysRegex")||an.call(this),r?this._weekdaysStrictRegex:this._weekdaysRegex):(ge(this,"_weekdaysRegex")||(this._weekdaysRegex=yl),this._weekdaysStrictRegex&&r?this._weekdaysStrictRegex:this._weekdaysRegex)}function kl(r){return this._weekdaysParseExact?(ge(this,"_weekdaysRegex")||an.call(this),r?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ge(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=wl),this._weekdaysShortStrictRegex&&r?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Bl(r){return this._weekdaysParseExact?(ge(this,"_weekdaysRegex")||an.call(this),r?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ge(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=El),this._weekdaysMinStrictRegex&&r?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function an(){function r(l,g){return g.length-l.length}var e=[],t=[],s=[],i=[],n,a,o,d,c;for(n=0;n<7;n++)a=Ct([2e3,1]).day(n),o=Pt(this.weekdaysMin(a,"")),d=Pt(this.weekdaysShort(a,"")),c=Pt(this.weekdays(a,"")),e.push(o),t.push(d),s.push(c),i.push(o),i.push(d),i.push(c);e.sort(r),t.sort(r),s.sort(r),i.sort(r),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function on(){return this.hours()%12||12}function Il(){return this.hours()||24}J("H",["HH",2],0,"hour"),J("h",["hh",2],0,on),J("k",["kk",2],0,Il),J("hmm",0,0,function(){return""+on.apply(this)+Dt(this.minutes(),2)}),J("hmmss",0,0,function(){return""+on.apply(this)+Dt(this.minutes(),2)+Dt(this.seconds(),2)}),J("Hmm",0,0,function(){return""+this.hours()+Dt(this.minutes(),2)}),J("Hmmss",0,0,function(){return""+this.hours()+Dt(this.minutes(),2)+Dt(this.seconds(),2)});function oo(r,e){J(r,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}oo("a",!0),oo("A",!1);function co(r,e){return e._meridiemParse}Z("a",co),Z("A",co),Z("H",Ce,tn),Z("h",Ce,_r),Z("k",Ce,_r),Z("HH",Ce,tt),Z("hh",Ce,tt),Z("kk",Ce,tt),Z("hmm",Za),Z("hmmss",Xa),Z("Hmm",Za),Z("Hmmss",Xa),ye(["H","HH"],Pe),ye(["k","kk"],function(r,e,t){var s=ae(r);e[Pe]=s===24?0:s}),ye(["a","A"],function(r,e,t){t._isPm=t._locale.isPM(r),t._meridiem=r}),ye(["h","hh"],function(r,e,t){e[Pe]=ae(r),re(t).bigHour=!0}),ye("hmm",function(r,e,t){var s=r.length-2;e[Pe]=ae(r.substr(0,s)),e[gt]=ae(r.substr(s)),re(t).bigHour=!0}),ye("hmmss",function(r,e,t){var s=r.length-4,i=r.length-2;e[Pe]=ae(r.substr(0,s)),e[gt]=ae(r.substr(s,2)),e[$t]=ae(r.substr(i)),re(t).bigHour=!0}),ye("Hmm",function(r,e,t){var s=r.length-2;e[Pe]=ae(r.substr(0,s)),e[gt]=ae(r.substr(s))}),ye("Hmmss",function(r,e,t){var s=r.length-4,i=r.length-2;e[Pe]=ae(r.substr(0,s)),e[gt]=ae(r.substr(s,2)),e[$t]=ae(r.substr(i))});function Pl(r){return(r+"").toLowerCase().charAt(0)==="p"}var Hl=/[ap]\.?m?\.?/i,$l=Dr("Hours",!0);function Nl(r,e,t){return r>11?t?"pm":"PM":t?"am":"AM"}var lo={calendar:Dc,longDateFormat:Rc,invalidDate:kc,ordinal:Ic,dayOfMonthOrdinalParse:Pc,relativeTime:$c,months:Jc,monthsShort:eo,week:dl,weekdays:ml,weekdaysMin:vl,weekdaysShort:ao,meridiemParse:Hl},De={},Jr={},Qr;function Ol(r,e){var t,s=Math.min(r.length,e.length);for(t=0;t<s;t+=1)if(r[t]!==e[t])return t;return s}function ho(r){return r&&r.toLowerCase().replace("_","-")}function Ml(r){for(var e=0,t,s,i,n;e<r.length;){for(n=ho(r[e]).split("-"),t=n.length,s=ho(r[e+1]),s=s?s.split("-"):null;t>0;){if(i=Ss(n.slice(0,t).join("-")),i)return i;if(s&&s.length>=t&&Ol(n,s)>=t-1)break;t--}e++}return Qr}function jl(r){return!!(r&&r.match("^[^/\\\\]*$"))}function Ss(r){var e=null,t;if(De[r]===void 0&&typeof module<"u"&&module&&module.exports&&jl(r))try{e=Qr._abbr,t=require,t("./locale/"+r),Jt(e)}catch{De[r]=null}return De[r]}function Jt(r,e){var t;return r&&(Ze(e)?t=Ot(r):t=cn(r,e),t?Qr=t:typeof console<"u"&&console.warn&&console.warn("Locale "+r+" not found. Did you forget to load it?")),Qr._abbr}function cn(r,e){if(e!==null){var t,s=lo;if(e.abbr=r,De[r]!=null)Wa("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=De[r]._config;else if(e.parentLocale!=null)if(De[e.parentLocale]!=null)s=De[e.parentLocale]._config;else if(t=Ss(e.parentLocale),t!=null)s=t._config;else return Jr[e.parentLocale]||(Jr[e.parentLocale]=[]),Jr[e.parentLocale].push({name:r,config:e}),null;return De[r]=new zi(Vi(s,e)),Jr[r]&&Jr[r].forEach(function(i){cn(i.name,i.config)}),Jt(r),De[r]}else return delete De[r],null}function ql(r,e){if(e!=null){var t,s,i=lo;De[r]!=null&&De[r].parentLocale!=null?De[r].set(Vi(De[r]._config,e)):(s=Ss(r),s!=null&&(i=s._config),e=Vi(i,e),s==null&&(e.abbr=r),t=new zi(e),t.parentLocale=De[r],De[r]=t),Jt(r)}else De[r]!=null&&(De[r].parentLocale!=null?(De[r]=De[r].parentLocale,r===Jt()&&Jt(r)):De[r]!=null&&delete De[r]);return De[r]}function Ot(r){var e;if(r&&r._locale&&r._locale._abbr&&(r=r._locale._abbr),!r)return Qr;if(!ut(r)){if(e=Ss(r),e)return e;r=[r]}return Ml(r)}function Ul(){return Ki(De)}function ln(r){var e,t=r._a;return t&&re(r).overflow===-2&&(e=t[Ht]<0||t[Ht]>11?Ht:t[At]<1||t[At]>sn(t[Le],t[Ht])?At:t[Pe]<0||t[Pe]>24||t[Pe]===24&&(t[gt]!==0||t[$t]!==0||t[hr]!==0)?Pe:t[gt]<0||t[gt]>59?gt:t[$t]<0||t[$t]>59?$t:t[hr]<0||t[hr]>999?hr:-1,re(r)._overflowDayOfYear&&(e<Le||e>At)&&(e=At),re(r)._overflowWeeks&&e===-1&&(e=Gc),re(r)._overflowWeekday&&e===-1&&(e=Vc),re(r).overflow=e),r}var Ll=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Yl=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Wl=/Z|[+-]\d\d(?::?\d\d)?/,Ts=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],dn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Gl=/^\/?Date\((-?\d+)/i,Vl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,zl={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function uo(r){var e,t,s=r._i,i=Ll.exec(s)||Yl.exec(s),n,a,o,d,c=Ts.length,l=dn.length;if(i){for(re(r).iso=!0,e=0,t=c;e<t;e++)if(Ts[e][1].exec(i[1])){a=Ts[e][0],n=Ts[e][2]!==!1;break}if(a==null){r._isValid=!1;return}if(i[3]){for(e=0,t=l;e<t;e++)if(dn[e][1].exec(i[3])){o=(i[2]||" ")+dn[e][0];break}if(o==null){r._isValid=!1;return}}if(!n&&o!=null){r._isValid=!1;return}if(i[4])if(Wl.exec(i[4]))d="Z";else{r._isValid=!1;return}r._f=a+(o||"")+(d||""),un(r)}else r._isValid=!1}function Kl(r,e,t,s,i,n){var a=[Zl(r),eo.indexOf(e),parseInt(t,10),parseInt(s,10),parseInt(i,10)];return n&&a.push(parseInt(n,10)),a}function Zl(r){var e=parseInt(r,10);return e<=49?2e3+e:e<=999?1900+e:e}function Xl(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Jl(r,e,t){if(r){var s=ao.indexOf(r),i=new Date(e[0],e[1],e[2]).getDay();if(s!==i)return re(t).weekdayMismatch=!0,t._isValid=!1,!1}return!0}function Ql(r,e,t){if(r)return zl[r];if(e)return 0;var s=parseInt(t,10),i=s%100,n=(s-i)/100;return n*60+i}function fo(r){var e=Vl.exec(Xl(r._i)),t;if(e){if(t=Kl(e[4],e[3],e[2],e[5],e[6],e[7]),!Jl(e[1],t,r))return;r._a=t,r._tzm=Ql(e[8],e[9],e[10]),r._d=Zr.apply(null,r._a),r._d.setUTCMinutes(r._d.getUTCMinutes()-r._tzm),re(r).rfc2822=!0}else r._isValid=!1}function ed(r){var e=Gl.exec(r._i);if(e!==null){r._d=new Date(+e[1]);return}if(uo(r),r._isValid===!1)delete r._isValid;else return;if(fo(r),r._isValid===!1)delete r._isValid;else return;r._strict?r._isValid=!1:Y.createFromInputFallback(r)}Y.createFromInputFallback=it("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(r){r._d=new Date(r._i+(r._useUTC?" UTC":""))});function Ar(r,e,t){return r??e??t}function td(r){var e=new Date(Y.now());return r._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function hn(r){var e,t,s=[],i,n,a;if(!r._d){for(i=td(r),r._w&&r._a[At]==null&&r._a[Ht]==null&&rd(r),r._dayOfYear!=null&&(a=Ar(r._a[Le],i[Le]),(r._dayOfYear>zr(a)||r._dayOfYear===0)&&(re(r)._overflowDayOfYear=!0),t=Zr(a,0,r._dayOfYear),r._a[Ht]=t.getUTCMonth(),r._a[At]=t.getUTCDate()),e=0;e<3&&r._a[e]==null;++e)r._a[e]=s[e]=i[e];for(;e<7;e++)r._a[e]=s[e]=r._a[e]==null?e===2?1:0:r._a[e];r._a[Pe]===24&&r._a[gt]===0&&r._a[$t]===0&&r._a[hr]===0&&(r._nextDay=!0,r._a[Pe]=0),r._d=(r._useUTC?Zr:cl).apply(null,s),n=r._useUTC?r._d.getUTCDay():r._d.getDay(),r._tzm!=null&&r._d.setUTCMinutes(r._d.getUTCMinutes()-r._tzm),r._nextDay&&(r._a[Pe]=24),r._w&&typeof r._w.d<"u"&&r._w.d!==n&&(re(r).weekdayMismatch=!0)}}function rd(r){var e,t,s,i,n,a,o,d,c;e=r._w,e.GG!=null||e.W!=null||e.E!=null?(n=1,a=4,t=Ar(e.GG,r._a[Le],Xr(_e(),1,4).year),s=Ar(e.W,1),i=Ar(e.E,1),(i<1||i>7)&&(d=!0)):(n=r._locale._week.dow,a=r._locale._week.doy,c=Xr(_e(),n,a),t=Ar(e.gg,r._a[Le],c.year),s=Ar(e.w,c.week),e.d!=null?(i=e.d,(i<0||i>6)&&(d=!0)):e.e!=null?(i=e.e+n,(e.e<0||e.e>6)&&(d=!0)):i=n),s<1||s>Nt(t,n,a)?re(r)._overflowWeeks=!0:d!=null?re(r)._overflowWeekday=!0:(o=no(t,s,i,n,a),r._a[Le]=o.year,r._dayOfYear=o.dayOfYear)}Y.ISO_8601=function(){},Y.RFC_2822=function(){};function un(r){if(r._f===Y.ISO_8601){uo(r);return}if(r._f===Y.RFC_2822){fo(r);return}r._a=[],re(r).empty=!0;var e=""+r._i,t,s,i,n,a,o=e.length,d=0,c,l;for(i=Ga(r._f,r._locale).match(Zi)||[],l=i.length,t=0;t<l;t++)n=i[t],s=(e.match(Lc(n,r))||[])[0],s&&(a=e.substr(0,e.indexOf(s)),a.length>0&&re(r).unusedInput.push(a),e=e.slice(e.indexOf(s)+s.length),d+=s.length),br[n]?(s?re(r).empty=!1:re(r).unusedTokens.push(n),Wc(n,s,r)):r._strict&&!s&&re(r).unusedTokens.push(n);re(r).charsLeftOver=o-d,e.length>0&&re(r).unusedInput.push(e),r._a[Pe]<=12&&re(r).bigHour===!0&&r._a[Pe]>0&&(re(r).bigHour=void 0),re(r).parsedDateParts=r._a.slice(0),re(r).meridiem=r._meridiem,r._a[Pe]=sd(r._locale,r._a[Pe],r._meridiem),c=re(r).era,c!==null&&(r._a[Le]=r._locale.erasConvertYear(c,r._a[Le])),hn(r),ln(r)}function sd(r,e,t){var s;return t==null?e:r.meridiemHour!=null?r.meridiemHour(e,t):(r.isPM!=null&&(s=r.isPM(t),s&&e<12&&(e+=12),!s&&e===12&&(e=0)),e)}function id(r){var e,t,s,i,n,a,o=!1,d=r._f.length;if(d===0){re(r).invalidFormat=!0,r._d=new Date(NaN);return}for(i=0;i<d;i++)n=0,a=!1,e=Gi({},r),r._useUTC!=null&&(e._useUTC=r._useUTC),e._f=r._f[i],un(e),Yi(e)&&(a=!0),n+=re(e).charsLeftOver,n+=re(e).unusedTokens.length*10,re(e).score=n,o?n<s&&(s=n,t=e):(s==null||n<s||a)&&(s=n,t=e,a&&(o=!0));Xt(r,t||e)}function nd(r){if(!r._d){var e=Ji(r._i),t=e.day===void 0?e.date:e.day;r._a=qa([e.year,e.month,t,e.hour,e.minute,e.second,e.millisecond],function(s){return s&&parseInt(s,10)}),hn(r)}}function ad(r){var e=new Wr(ln(go(r)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function go(r){var e=r._i,t=r._f;return r._locale=r._locale||Ot(r._l),e===null||t===void 0&&e===""?ps({nullInput:!0}):(typeof e=="string"&&(r._i=e=r._locale.preparse(e)),ft(e)?new Wr(ln(e)):(Yr(e)?r._d=e:ut(t)?id(r):t?un(r):od(r),Yi(r)||(r._d=null),r))}function od(r){var e=r._i;Ze(e)?r._d=new Date(Y.now()):Yr(e)?r._d=new Date(e.valueOf()):typeof e=="string"?ed(r):ut(e)?(r._a=qa(e.slice(0),function(t){return parseInt(t,10)}),hn(r)):dr(e)?nd(r):It(e)?r._d=new Date(e):Y.createFromInputFallback(r)}function xo(r,e,t,s,i){var n={};return(e===!0||e===!1)&&(s=e,e=void 0),(t===!0||t===!1)&&(s=t,t=void 0),(dr(r)&&Ui(r)||ut(r)&&r.length===0)&&(r=void 0),n._isAMomentObject=!0,n._useUTC=n._isUTC=i,n._l=t,n._i=r,n._f=e,n._strict=s,ad(n)}function _e(r,e,t,s){return xo(r,e,t,s,!1)}var cd=it("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var r=_e.apply(null,arguments);return this.isValid()&&r.isValid()?r<this?this:r:ps()}),ld=it("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var r=_e.apply(null,arguments);return this.isValid()&&r.isValid()?r>this?this:r:ps()});function po(r,e){var t,s;if(e.length===1&&ut(e[0])&&(e=e[0]),!e.length)return _e();for(t=e[0],s=1;s<e.length;++s)(!e[s].isValid()||e[s][r](t))&&(t=e[s]);return t}function dd(){var r=[].slice.call(arguments,0);return po("isBefore",r)}function hd(){var r=[].slice.call(arguments,0);return po("isAfter",r)}var ud=function(){return Date.now?Date.now():+new Date},es=["year","quarter","month","week","day","hour","minute","second","millisecond"];function fd(r){var e,t=!1,s,i=es.length;for(e in r)if(ge(r,e)&&!(Te.call(es,e)!==-1&&(r[e]==null||!isNaN(r[e]))))return!1;for(s=0;s<i;++s)if(r[es[s]]){if(t)return!1;parseFloat(r[es[s]])!==ae(r[es[s]])&&(t=!0)}return!0}function gd(){return this._isValid}function xd(){return xt(NaN)}function Rs(r){var e=Ji(r),t=e.year||0,s=e.quarter||0,i=e.month||0,n=e.week||e.isoWeek||0,a=e.day||0,o=e.hour||0,d=e.minute||0,c=e.second||0,l=e.millisecond||0;this._isValid=fd(e),this._milliseconds=+l+c*1e3+d*6e4+o*1e3*60*60,this._days=+a+n*7,this._months=+i+s*3+t*12,this._data={},this._locale=Ot(),this._bubble()}function Fs(r){return r instanceof Rs}function fn(r){return r<0?Math.round(-1*r)*-1:Math.round(r)}function pd(r,e,t){var s=Math.min(r.length,e.length),i=Math.abs(r.length-e.length),n=0,a;for(a=0;a<s;a++)ae(r[a])!==ae(e[a])&&n++;return n+i}function mo(r,e){J(r,0,0,function(){var t=this.utcOffset(),s="+";return t<0&&(t=-t,s="-"),s+Dt(~~(t/60),2)+e+Dt(~~t%60,2)})}mo("Z",":"),mo("ZZ",""),Z("Z",Cs),Z("ZZ",Cs),ye(["Z","ZZ"],function(r,e,t){t._useUTC=!0,t._tzm=gn(Cs,r)});var md=/([\+\-]|\d\d)/gi;function gn(r,e){var t=(e||"").match(r),s,i,n;return t===null?null:(s=t[t.length-1]||[],i=(s+"").match(md)||["-",0,0],n=+(i[1]*60)+ae(i[2]),n===0?0:i[0]==="+"?n:-n)}function xn(r,e){var t,s;return e._isUTC?(t=e.clone(),s=(ft(r)||Yr(r)?r.valueOf():_e(r).valueOf())-t.valueOf(),t._d.setTime(t._d.valueOf()+s),Y.updateOffset(t,!1),t):_e(r).local()}function pn(r){return-Math.round(r._d.getTimezoneOffset())}Y.updateOffset=function(){};function vd(r,e,t){var s=this._offset||0,i;if(!this.isValid())return r!=null?this:NaN;if(r!=null){if(typeof r=="string"){if(r=gn(Cs,r),r===null)return this}else Math.abs(r)<16&&!t&&(r=r*60);return!this._isUTC&&e&&(i=pn(this)),this._offset=r,this._isUTC=!0,i!=null&&this.add(i,"m"),s!==r&&(!e||this._changeInProgress?Eo(this,xt(r-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,Y.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?s:pn(this)}function yd(r,e){return r!=null?(typeof r!="string"&&(r=-r),this.utcOffset(r,e),this):-this.utcOffset()}function wd(r){return this.utcOffset(0,r)}function Ed(r){return this._isUTC&&(this.utcOffset(0,r),this._isUTC=!1,r&&this.subtract(pn(this),"m")),this}function bd(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var r=gn(qc,this._i);r!=null?this.utcOffset(r):this.utcOffset(0,!0)}return this}function Cd(r){return this.isValid()?(r=r?_e(r).utcOffset():0,(this.utcOffset()-r)%60===0):!1}function _d(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Dd(){if(!Ze(this._isDSTShifted))return this._isDSTShifted;var r={},e;return Gi(r,this),r=go(r),r._a?(e=r._isUTC?Ct(r._a):_e(r._a),this._isDSTShifted=this.isValid()&&pd(r._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Ad(){return this.isValid()?!this._isUTC:!1}function Sd(){return this.isValid()?this._isUTC:!1}function vo(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Td=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Rd=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function xt(r,e){var t=r,s=null,i,n,a;return Fs(r)?t={ms:r._milliseconds,d:r._days,M:r._months}:It(r)||!isNaN(+r)?(t={},e?t[e]=+r:t.milliseconds=+r):(s=Td.exec(r))?(i=s[1]==="-"?-1:1,t={y:0,d:ae(s[At])*i,h:ae(s[Pe])*i,m:ae(s[gt])*i,s:ae(s[$t])*i,ms:ae(fn(s[hr]*1e3))*i}):(s=Rd.exec(r))?(i=s[1]==="-"?-1:1,t={y:ur(s[2],i),M:ur(s[3],i),w:ur(s[4],i),d:ur(s[5],i),h:ur(s[6],i),m:ur(s[7],i),s:ur(s[8],i)}):t==null?t={}:typeof t=="object"&&("from"in t||"to"in t)&&(a=Fd(_e(t.from),_e(t.to)),t={},t.ms=a.milliseconds,t.M=a.months),n=new Rs(t),Fs(r)&&ge(r,"_locale")&&(n._locale=r._locale),Fs(r)&&ge(r,"_isValid")&&(n._isValid=r._isValid),n}xt.fn=Rs.prototype,xt.invalid=xd;function ur(r,e){var t=r&&parseFloat(r.replace(",","."));return(isNaN(t)?0:t)*e}function yo(r,e){var t={};return t.months=e.month()-r.month()+(e.year()-r.year())*12,r.clone().add(t.months,"M").isAfter(e)&&--t.months,t.milliseconds=+e-+r.clone().add(t.months,"M"),t}function Fd(r,e){var t;return r.isValid()&&e.isValid()?(e=xn(e,r),r.isBefore(e)?t=yo(r,e):(t=yo(e,r),t.milliseconds=-t.milliseconds,t.months=-t.months),t):{milliseconds:0,months:0}}function wo(r,e){return function(t,s){var i,n;return s!==null&&!isNaN(+s)&&(Wa(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=t,t=s,s=n),i=xt(t,s),Eo(this,i,r),this}}function Eo(r,e,t,s){var i=e._milliseconds,n=fn(e._days),a=fn(e._months);r.isValid()&&(s=s??!0,a&&ro(r,Kr(r,"Month")+a*t),n&&Qa(r,"Date",Kr(r,"Date")+n*t),i&&r._d.setTime(r._d.valueOf()+i*t),s&&Y.updateOffset(r,n||a))}var kd=wo(1,"add"),Bd=wo(-1,"subtract");function bo(r){return typeof r=="string"||r instanceof String}function Id(r){return ft(r)||Yr(r)||bo(r)||It(r)||Hd(r)||Pd(r)||r===null||r===void 0}function Pd(r){var e=dr(r)&&!Ui(r),t=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,n,a=s.length;for(i=0;i<a;i+=1)n=s[i],t=t||ge(r,n);return e&&t}function Hd(r){var e=ut(r),t=!1;return e&&(t=r.filter(function(s){return!It(s)&&bo(r)}).length===0),e&&t}function $d(r){var e=dr(r)&&!Ui(r),t=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,n;for(i=0;i<s.length;i+=1)n=s[i],t=t||ge(r,n);return e&&t}function Nd(r,e){var t=r.diff(e,"days",!0);return t<-6?"sameElse":t<-1?"lastWeek":t<0?"lastDay":t<1?"sameDay":t<2?"nextDay":t<7?"nextWeek":"sameElse"}function Od(r,e){arguments.length===1&&(arguments[0]?Id(arguments[0])?(r=arguments[0],e=void 0):$d(arguments[0])&&(e=arguments[0],r=void 0):(r=void 0,e=void 0));var t=r||_e(),s=xn(t,this).startOf("day"),i=Y.calendarFormat(this,s)||"sameElse",n=e&&(_t(e[i])?e[i].call(this,t):e[i]);return this.format(n||this.localeData().calendar(i,this,_e(t)))}function Md(){return new Wr(this)}function jd(r,e){var t=ft(r)?r:_e(r);return this.isValid()&&t.isValid()?(e=nt(e)||"millisecond",e==="millisecond"?this.valueOf()>t.valueOf():t.valueOf()<this.clone().startOf(e).valueOf()):!1}function qd(r,e){var t=ft(r)?r:_e(r);return this.isValid()&&t.isValid()?(e=nt(e)||"millisecond",e==="millisecond"?this.valueOf()<t.valueOf():this.clone().endOf(e).valueOf()<t.valueOf()):!1}function Ud(r,e,t,s){var i=ft(r)?r:_e(r),n=ft(e)?e:_e(e);return this.isValid()&&i.isValid()&&n.isValid()?(s=s||"()",(s[0]==="("?this.isAfter(i,t):!this.isBefore(i,t))&&(s[1]===")"?this.isBefore(n,t):!this.isAfter(n,t))):!1}function Ld(r,e){var t=ft(r)?r:_e(r),s;return this.isValid()&&t.isValid()?(e=nt(e)||"millisecond",e==="millisecond"?this.valueOf()===t.valueOf():(s=t.valueOf(),this.clone().startOf(e).valueOf()<=s&&s<=this.clone().endOf(e).valueOf())):!1}function Yd(r,e){return this.isSame(r,e)||this.isAfter(r,e)}function Wd(r,e){return this.isSame(r,e)||this.isBefore(r,e)}function Gd(r,e,t){var s,i,n;if(!this.isValid())return NaN;if(s=xn(r,this),!s.isValid())return NaN;switch(i=(s.utcOffset()-this.utcOffset())*6e4,e=nt(e),e){case"year":n=ks(this,s)/12;break;case"month":n=ks(this,s);break;case"quarter":n=ks(this,s)/3;break;case"second":n=(this-s)/1e3;break;case"minute":n=(this-s)/6e4;break;case"hour":n=(this-s)/36e5;break;case"day":n=(this-s-i)/864e5;break;case"week":n=(this-s-i)/6048e5;break;default:n=this-s}return t?n:at(n)}function ks(r,e){if(r.date()<e.date())return-ks(e,r);var t=(e.year()-r.year())*12+(e.month()-r.month()),s=r.clone().add(t,"months"),i,n;return e-s<0?(i=r.clone().add(t-1,"months"),n=(e-s)/(s-i)):(i=r.clone().add(t+1,"months"),n=(e-s)/(i-s)),-(t+n)||0}Y.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",Y.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Vd(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function zd(r){if(!this.isValid())return null;var e=r!==!0,t=e?this.clone().utc():this;return t.year()<0||t.year()>9999?vs(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):_t(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",vs(t,"Z")):vs(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Kd(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var r="moment",e="",t,s,i,n;return this.isLocal()||(r=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),t="["+r+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",n=e+'[")]',this.format(t+s+i+n)}function Zd(r){r||(r=this.isUtc()?Y.defaultFormatUtc:Y.defaultFormat);var e=vs(this,r);return this.localeData().postformat(e)}function Xd(r,e){return this.isValid()&&(ft(r)&&r.isValid()||_e(r).isValid())?xt({to:this,from:r}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function Jd(r){return this.from(_e(),r)}function Qd(r,e){return this.isValid()&&(ft(r)&&r.isValid()||_e(r).isValid())?xt({from:this,to:r}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function eh(r){return this.to(_e(),r)}function Co(r){var e;return r===void 0?this._locale._abbr:(e=Ot(r),e!=null&&(this._locale=e),this)}var _o=it("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(r){return r===void 0?this.localeData():this.locale(r)});function Do(){return this._locale}var Bs=1e3,Sr=60*Bs,Is=60*Sr,Ao=(365*400+97)*24*Is;function Tr(r,e){return(r%e+e)%e}function So(r,e,t){return r<100&&r>=0?new Date(r+400,e,t)-Ao:new Date(r,e,t).valueOf()}function To(r,e,t){return r<100&&r>=0?Date.UTC(r+400,e,t)-Ao:Date.UTC(r,e,t)}function th(r){var e,t;if(r=nt(r),r===void 0||r==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?To:So,r){case"year":e=t(this.year(),0,1);break;case"quarter":e=t(this.year(),this.month()-this.month()%3,1);break;case"month":e=t(this.year(),this.month(),1);break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=t(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=Tr(e+(this._isUTC?0:this.utcOffset()*Sr),Is);break;case"minute":e=this._d.valueOf(),e-=Tr(e,Sr);break;case"second":e=this._d.valueOf(),e-=Tr(e,Bs);break}return this._d.setTime(e),Y.updateOffset(this,!0),this}function rh(r){var e,t;if(r=nt(r),r===void 0||r==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?To:So,r){case"year":e=t(this.year()+1,0,1)-1;break;case"quarter":e=t(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=t(this.year(),this.month()+1,1)-1;break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=t(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=Is-Tr(e+(this._isUTC?0:this.utcOffset()*Sr),Is)-1;break;case"minute":e=this._d.valueOf(),e+=Sr-Tr(e,Sr)-1;break;case"second":e=this._d.valueOf(),e+=Bs-Tr(e,Bs)-1;break}return this._d.setTime(e),Y.updateOffset(this,!0),this}function sh(){return this._d.valueOf()-(this._offset||0)*6e4}function ih(){return Math.floor(this.valueOf()/1e3)}function nh(){return new Date(this.valueOf())}function ah(){var r=this;return[r.year(),r.month(),r.date(),r.hour(),r.minute(),r.second(),r.millisecond()]}function oh(){var r=this;return{years:r.year(),months:r.month(),date:r.date(),hours:r.hours(),minutes:r.minutes(),seconds:r.seconds(),milliseconds:r.milliseconds()}}function ch(){return this.isValid()?this.toISOString():null}function lh(){return Yi(this)}function dh(){return Xt({},re(this))}function hh(){return re(this).overflow}function uh(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}J("N",0,0,"eraAbbr"),J("NN",0,0,"eraAbbr"),J("NNN",0,0,"eraAbbr"),J("NNNN",0,0,"eraName"),J("NNNNN",0,0,"eraNarrow"),J("y",["y",1],"yo","eraYear"),J("y",["yy",2],0,"eraYear"),J("y",["yyy",3],0,"eraYear"),J("y",["yyyy",4],0,"eraYear"),Z("N",mn),Z("NN",mn),Z("NNN",mn),Z("NNNN",Ch),Z("NNNNN",_h),ye(["N","NN","NNN","NNNN","NNNNN"],function(r,e,t,s){var i=t._locale.erasParse(r,s,t._strict);i?re(t).era=i:re(t).invalidEra=r}),Z("y",Cr),Z("yy",Cr),Z("yyy",Cr),Z("yyyy",Cr),Z("yo",Dh),ye(["y","yy","yyy","yyyy"],Le),ye(["yo"],function(r,e,t,s){var i;t._locale._eraYearOrdinalRegex&&(i=r.match(t._locale._eraYearOrdinalRegex)),t._locale.eraYearOrdinalParse?e[Le]=t._locale.eraYearOrdinalParse(r,i):e[Le]=parseInt(r,10)});function fh(r,e){var t,s,i,n=this._eras||Ot("en")._eras;for(t=0,s=n.length;t<s;++t){switch(typeof n[t].since){case"string":i=Y(n[t].since).startOf("day"),n[t].since=i.valueOf();break}switch(typeof n[t].until){case"undefined":n[t].until=1/0;break;case"string":i=Y(n[t].until).startOf("day").valueOf(),n[t].until=i.valueOf();break}}return n}function gh(r,e,t){var s,i,n=this.eras(),a,o,d;for(r=r.toUpperCase(),s=0,i=n.length;s<i;++s)if(a=n[s].name.toUpperCase(),o=n[s].abbr.toUpperCase(),d=n[s].narrow.toUpperCase(),t)switch(e){case"N":case"NN":case"NNN":if(o===r)return n[s];break;case"NNNN":if(a===r)return n[s];break;case"NNNNN":if(d===r)return n[s];break}else if([a,o,d].indexOf(r)>=0)return n[s]}function xh(r,e){var t=r.since<=r.until?1:-1;return e===void 0?Y(r.since).year():Y(r.since).year()+(e-r.offset)*t}function ph(){var r,e,t,s=this.localeData().eras();for(r=0,e=s.length;r<e;++r)if(t=this.clone().startOf("day").valueOf(),s[r].since<=t&&t<=s[r].until||s[r].until<=t&&t<=s[r].since)return s[r].name;return""}function mh(){var r,e,t,s=this.localeData().eras();for(r=0,e=s.length;r<e;++r)if(t=this.clone().startOf("day").valueOf(),s[r].since<=t&&t<=s[r].until||s[r].until<=t&&t<=s[r].since)return s[r].narrow;return""}function vh(){var r,e,t,s=this.localeData().eras();for(r=0,e=s.length;r<e;++r)if(t=this.clone().startOf("day").valueOf(),s[r].since<=t&&t<=s[r].until||s[r].until<=t&&t<=s[r].since)return s[r].abbr;return""}function yh(){var r,e,t,s,i=this.localeData().eras();for(r=0,e=i.length;r<e;++r)if(t=i[r].since<=i[r].until?1:-1,s=this.clone().startOf("day").valueOf(),i[r].since<=s&&s<=i[r].until||i[r].until<=s&&s<=i[r].since)return(this.year()-Y(i[r].since).year())*t+i[r].offset;return this.year()}function wh(r){return ge(this,"_erasNameRegex")||vn.call(this),r?this._erasNameRegex:this._erasRegex}function Eh(r){return ge(this,"_erasAbbrRegex")||vn.call(this),r?this._erasAbbrRegex:this._erasRegex}function bh(r){return ge(this,"_erasNarrowRegex")||vn.call(this),r?this._erasNarrowRegex:this._erasRegex}function mn(r,e){return e.erasAbbrRegex(r)}function Ch(r,e){return e.erasNameRegex(r)}function _h(r,e){return e.erasNarrowRegex(r)}function Dh(r,e){return e._eraYearOrdinalRegex||Cr}function vn(){var r=[],e=[],t=[],s=[],i,n,a,o,d,c=this.eras();for(i=0,n=c.length;i<n;++i)a=Pt(c[i].name),o=Pt(c[i].abbr),d=Pt(c[i].narrow),e.push(a),r.push(o),t.push(d),s.push(a),s.push(o),s.push(d);this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+t.join("|")+")","i")}J(0,["gg",2],0,function(){return this.weekYear()%100}),J(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Ps(r,e){J(0,[r,r.length],0,e)}Ps("gggg","weekYear"),Ps("ggggg","weekYear"),Ps("GGGG","isoWeekYear"),Ps("GGGGG","isoWeekYear"),Z("G",bs),Z("g",bs),Z("GG",Ce,tt),Z("gg",Ce,tt),Z("GGGG",en,Qi),Z("gggg",en,Qi),Z("GGGGG",Es,ys),Z("ggggg",Es,ys),Vr(["gggg","ggggg","GGGG","GGGGG"],function(r,e,t,s){e[s.substr(0,2)]=ae(r)}),Vr(["gg","GG"],function(r,e,t,s){e[s]=Y.parseTwoDigitYear(r)});function Ah(r){return Ro.call(this,r,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Sh(r){return Ro.call(this,r,this.isoWeek(),this.isoWeekday(),1,4)}function Th(){return Nt(this.year(),1,4)}function Rh(){return Nt(this.isoWeekYear(),1,4)}function Fh(){var r=this.localeData()._week;return Nt(this.year(),r.dow,r.doy)}function kh(){var r=this.localeData()._week;return Nt(this.weekYear(),r.dow,r.doy)}function Ro(r,e,t,s,i){var n;return r==null?Xr(this,s,i).year:(n=Nt(r,s,i),e>n&&(e=n),Bh.call(this,r,e,t,s,i))}function Bh(r,e,t,s,i){var n=no(r,e,t,s,i),a=Zr(n.year,0,n.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}J("Q",0,"Qo","quarter"),Z("Q",za),ye("Q",function(r,e){e[Ht]=(ae(r)-1)*3});function Ih(r){return r==null?Math.ceil((this.month()+1)/3):this.month((r-1)*3+this.month()%3)}J("D",["DD",2],"Do","date"),Z("D",Ce,_r),Z("DD",Ce,tt),Z("Do",function(r,e){return r?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),ye(["D","DD"],At),ye("Do",function(r,e){e[At]=ae(r.match(Ce)[0])});var Fo=Dr("Date",!0);J("DDD",["DDDD",3],"DDDo","dayOfYear"),Z("DDD",ws),Z("DDDD",Ka),ye(["DDD","DDDD"],function(r,e,t){t._dayOfYear=ae(r)});function Ph(r){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return r==null?e:this.add(r-e,"d")}J("m",["mm",2],0,"minute"),Z("m",Ce,tn),Z("mm",Ce,tt),ye(["m","mm"],gt);var Hh=Dr("Minutes",!1);J("s",["ss",2],0,"second"),Z("s",Ce,tn),Z("ss",Ce,tt),ye(["s","ss"],$t);var $h=Dr("Seconds",!1);J("S",0,0,function(){return~~(this.millisecond()/100)}),J(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),J(0,["SSS",3],0,"millisecond"),J(0,["SSSS",4],0,function(){return this.millisecond()*10}),J(0,["SSSSS",5],0,function(){return this.millisecond()*100}),J(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),J(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),J(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),J(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Z("S",ws,za),Z("SS",ws,tt),Z("SSS",ws,Ka);var Qt,ko;for(Qt="SSSS";Qt.length<=9;Qt+="S")Z(Qt,Cr);function Nh(r,e){e[hr]=ae(("0."+r)*1e3)}for(Qt="S";Qt.length<=9;Qt+="S")ye(Qt,Nh);ko=Dr("Milliseconds",!1),J("z",0,0,"zoneAbbr"),J("zz",0,0,"zoneName");function Oh(){return this._isUTC?"UTC":""}function Mh(){return this._isUTC?"Coordinated Universal Time":""}var M=Wr.prototype;M.add=kd,M.calendar=Od,M.clone=Md,M.diff=Gd,M.endOf=rh,M.format=Zd,M.from=Xd,M.fromNow=Jd,M.to=Qd,M.toNow=eh,M.get=Kc,M.invalidAt=hh,M.isAfter=jd,M.isBefore=qd,M.isBetween=Ud,M.isSame=Ld,M.isSameOrAfter=Yd,M.isSameOrBefore=Wd,M.isValid=lh,M.lang=_o,M.locale=Co,M.localeData=Do,M.max=ld,M.min=cd,M.parsingFlags=dh,M.set=Zc,M.startOf=th,M.subtract=Bd,M.toArray=ah,M.toObject=oh,M.toDate=nh,M.toISOString=zd,M.inspect=Kd,typeof Symbol<"u"&&Symbol.for!=null&&(M[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),M.toJSON=ch,M.toString=Vd,M.unix=ih,M.valueOf=sh,M.creationData=uh,M.eraName=ph,M.eraNarrow=mh,M.eraAbbr=vh,M.eraYear=yh,M.year=Ja,M.isLeapYear=zc,M.weekYear=Ah,M.isoWeekYear=Sh,M.quarter=M.quarters=Ih,M.month=so,M.daysInMonth=nl,M.week=M.weeks=fl,M.isoWeek=M.isoWeeks=gl,M.weeksInYear=Fh,M.weeksInWeekYear=kh,M.isoWeeksInYear=Th,M.isoWeeksInISOWeekYear=Rh,M.date=Fo,M.day=M.days=Sl,M.weekday=Tl,M.isoWeekday=Rl,M.dayOfYear=Ph,M.hour=M.hours=$l,M.minute=M.minutes=Hh,M.second=M.seconds=$h,M.millisecond=M.milliseconds=ko,M.utcOffset=vd,M.utc=wd,M.local=Ed,M.parseZone=bd,M.hasAlignedHourOffset=Cd,M.isDST=_d,M.isLocal=Ad,M.isUtcOffset=Sd,M.isUtc=vo,M.isUTC=vo,M.zoneAbbr=Oh,M.zoneName=Mh,M.dates=it("dates accessor is deprecated. Use date instead.",Fo),M.months=it("months accessor is deprecated. Use month instead",so),M.years=it("years accessor is deprecated. Use year instead",Ja),M.zone=it("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",yd),M.isDSTShifted=it("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Dd);function jh(r){return _e(r*1e3)}function qh(){return _e.apply(null,arguments).parseZone()}function Bo(r){return r}var xe=zi.prototype;xe.calendar=Ac,xe.longDateFormat=Fc,xe.invalidDate=Bc,xe.ordinal=Hc,xe.preparse=Bo,xe.postformat=Bo,xe.relativeTime=Nc,xe.pastFuture=Oc,xe.set=_c,xe.eras=fh,xe.erasParse=gh,xe.erasConvertYear=xh,xe.erasAbbrRegex=Eh,xe.erasNameRegex=wh,xe.erasNarrowRegex=bh,xe.months=tl,xe.monthsShort=rl,xe.monthsParse=il,xe.monthsRegex=ol,xe.monthsShortRegex=al,xe.week=ll,xe.firstDayOfYear=ul,xe.firstDayOfWeek=hl,xe.weekdays=bl,xe.weekdaysMin=_l,xe.weekdaysShort=Cl,xe.weekdaysParse=Al,xe.weekdaysRegex=Fl,xe.weekdaysShortRegex=kl,xe.weekdaysMinRegex=Bl,xe.isPM=Pl,xe.meridiem=Nl;function Hs(r,e,t,s){var i=Ot(),n=Ct().set(s,e);return i[t](n,r)}function Io(r,e,t){if(It(r)&&(e=r,r=void 0),r=r||"",e!=null)return Hs(r,e,t,"month");var s,i=[];for(s=0;s<12;s++)i[s]=Hs(r,s,t,"month");return i}function yn(r,e,t,s){typeof r=="boolean"?(It(e)&&(t=e,e=void 0),e=e||""):(e=r,t=e,r=!1,It(e)&&(t=e,e=void 0),e=e||"");var i=Ot(),n=r?i._week.dow:0,a,o=[];if(t!=null)return Hs(e,(t+n)%7,s,"day");for(a=0;a<7;a++)o[a]=Hs(e,(a+n)%7,s,"day");return o}function Uh(r,e){return Io(r,e,"months")}function Lh(r,e){return Io(r,e,"monthsShort")}function Yh(r,e,t){return yn(r,e,t,"weekdays")}function Wh(r,e,t){return yn(r,e,t,"weekdaysShort")}function Gh(r,e,t){return yn(r,e,t,"weekdaysMin")}Jt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(r){var e=r%10,t=ae(r%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return r+t}}),Y.lang=it("moment.lang is deprecated. Use moment.locale instead.",Jt),Y.langData=it("moment.langData is deprecated. Use moment.localeData instead.",Ot);var Mt=Math.abs;function Vh(){var r=this._data;return this._milliseconds=Mt(this._milliseconds),this._days=Mt(this._days),this._months=Mt(this._months),r.milliseconds=Mt(r.milliseconds),r.seconds=Mt(r.seconds),r.minutes=Mt(r.minutes),r.hours=Mt(r.hours),r.months=Mt(r.months),r.years=Mt(r.years),this}function Po(r,e,t,s){var i=xt(e,t);return r._milliseconds+=s*i._milliseconds,r._days+=s*i._days,r._months+=s*i._months,r._bubble()}function zh(r,e){return Po(this,r,e,1)}function Kh(r,e){return Po(this,r,e,-1)}function Ho(r){return r<0?Math.floor(r):Math.ceil(r)}function Zh(){var r=this._milliseconds,e=this._days,t=this._months,s=this._data,i,n,a,o,d;return r>=0&&e>=0&&t>=0||r<=0&&e<=0&&t<=0||(r+=Ho(wn(t)+e)*864e5,e=0,t=0),s.milliseconds=r%1e3,i=at(r/1e3),s.seconds=i%60,n=at(i/60),s.minutes=n%60,a=at(n/60),s.hours=a%24,e+=at(a/24),d=at($o(e)),t+=d,e-=Ho(wn(d)),o=at(t/12),t%=12,s.days=e,s.months=t,s.years=o,this}function $o(r){return r*4800/146097}function wn(r){return r*146097/4800}function Xh(r){if(!this.isValid())return NaN;var e,t,s=this._milliseconds;if(r=nt(r),r==="month"||r==="quarter"||r==="year")switch(e=this._days+s/864e5,t=this._months+$o(e),r){case"month":return t;case"quarter":return t/3;case"year":return t/12}else switch(e=this._days+Math.round(wn(this._months)),r){case"week":return e/7+s/6048e5;case"day":return e+s/864e5;case"hour":return e*24+s/36e5;case"minute":return e*1440+s/6e4;case"second":return e*86400+s/1e3;case"millisecond":return Math.floor(e*864e5)+s;default:throw new Error("Unknown unit "+r)}}function jt(r){return function(){return this.as(r)}}var No=jt("ms"),Jh=jt("s"),Qh=jt("m"),eu=jt("h"),tu=jt("d"),ru=jt("w"),su=jt("M"),iu=jt("Q"),nu=jt("y"),au=No;function ou(){return xt(this)}function cu(r){return r=nt(r),this.isValid()?this[r+"s"]():NaN}function fr(r){return function(){return this.isValid()?this._data[r]:NaN}}var lu=fr("milliseconds"),du=fr("seconds"),hu=fr("minutes"),uu=fr("hours"),fu=fr("days"),gu=fr("months"),xu=fr("years");function pu(){return at(this.days()/7)}var qt=Math.round,Rr={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function mu(r,e,t,s,i){return i.relativeTime(e||1,!!t,r,s)}function vu(r,e,t,s){var i=xt(r).abs(),n=qt(i.as("s")),a=qt(i.as("m")),o=qt(i.as("h")),d=qt(i.as("d")),c=qt(i.as("M")),l=qt(i.as("w")),g=qt(i.as("y")),u=n<=t.ss&&["s",n]||n<t.s&&["ss",n]||a<=1&&["m"]||a<t.m&&["mm",a]||o<=1&&["h"]||o<t.h&&["hh",o]||d<=1&&["d"]||d<t.d&&["dd",d];return t.w!=null&&(u=u||l<=1&&["w"]||l<t.w&&["ww",l]),u=u||c<=1&&["M"]||c<t.M&&["MM",c]||g<=1&&["y"]||["yy",g],u[2]=e,u[3]=+r>0,u[4]=s,mu.apply(null,u)}function yu(r){return r===void 0?qt:typeof r=="function"?(qt=r,!0):!1}function wu(r,e){return Rr[r]===void 0?!1:e===void 0?Rr[r]:(Rr[r]=e,r==="s"&&(Rr.ss=e-1),!0)}function Eu(r,e){if(!this.isValid())return this.localeData().invalidDate();var t=!1,s=Rr,i,n;return typeof r=="object"&&(e=r,r=!1),typeof r=="boolean"&&(t=r),typeof e=="object"&&(s=Object.assign({},Rr,e),e.s!=null&&e.ss==null&&(s.ss=e.s-1)),i=this.localeData(),n=vu(this,!t,s,i),t&&(n=i.pastFuture(+this,n)),i.postformat(n)}var En=Math.abs;function Fr(r){return(r>0)-(r<0)||+r}function $s(){if(!this.isValid())return this.localeData().invalidDate();var r=En(this._milliseconds)/1e3,e=En(this._days),t=En(this._months),s,i,n,a,o=this.asSeconds(),d,c,l,g;return o?(s=at(r/60),i=at(s/60),r%=60,s%=60,n=at(t/12),t%=12,a=r?r.toFixed(3).replace(/\.?0+$/,""):"",d=o<0?"-":"",c=Fr(this._months)!==Fr(o)?"-":"",l=Fr(this._days)!==Fr(o)?"-":"",g=Fr(this._milliseconds)!==Fr(o)?"-":"",d+"P"+(n?c+n+"Y":"")+(t?c+t+"M":"")+(e?l+e+"D":"")+(i||s||r?"T":"")+(i?g+i+"H":"")+(s?g+s+"M":"")+(r?g+a+"S":"")):"P0D"}var le=Rs.prototype;le.isValid=gd,le.abs=Vh,le.add=zh,le.subtract=Kh,le.as=Xh,le.asMilliseconds=No,le.asSeconds=Jh,le.asMinutes=Qh,le.asHours=eu,le.asDays=tu,le.asWeeks=ru,le.asMonths=su,le.asQuarters=iu,le.asYears=nu,le.valueOf=au,le._bubble=Zh,le.clone=ou,le.get=cu,le.milliseconds=lu,le.seconds=du,le.minutes=hu,le.hours=uu,le.days=fu,le.weeks=pu,le.months=gu,le.years=xu,le.humanize=Eu,le.toISOString=$s,le.toString=$s,le.toJSON=$s,le.locale=Co,le.localeData=Do,le.toIsoString=it("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$s),le.lang=_o,J("X",0,0,"unix"),J("x",0,0,"valueOf"),Z("x",bs),Z("X",Uc),ye("X",function(r,e,t){t._d=new Date(parseFloat(r)*1e3)}),ye("x",function(r,e,t){t._d=new Date(ae(r))});//! moment.js
|
|
215
|
-
|
|
216
|
-
`);
|
|
217
|
-
`)||(
|
|
218
|
-
`),console.log("[RTC Patch] filtered to",(
|
|
214
|
+
`+new Error().stack),t=!1}return e.apply(this,arguments)},e)}var Ya={};function Wa(r,e){W.deprecationHandler!=null&&W.deprecationHandler(r,e),Ya[r]||(La(e),Ya[r]=!0)}W.suppressDeprecationWarnings=!1,W.deprecationHandler=null;function _t(r){return typeof Function<"u"&&r instanceof Function||Object.prototype.toString.call(r)==="[object Function]"}function _c(r){var e,t;for(t in r)ge(r,t)&&(e=r[t],_t(e)?this[t]=e:this["_"+t]=e);this._config=r,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Vi(r,e){var t=Xt({},r),s;for(s in e)ge(e,s)&&(dr(r[s])&&dr(e[s])?(t[s]={},Xt(t[s],r[s]),Xt(t[s],e[s])):e[s]!=null?t[s]=e[s]:delete t[s]);for(s in r)ge(r,s)&&!ge(e,s)&&dr(r[s])&&(t[s]=Xt({},t[s]));return t}function zi(r){r!=null&&this.set(r)}var Ki;Object.keys?Ki=Object.keys:Ki=function(r){var e,t=[];for(e in r)ge(r,e)&&t.push(e);return t};var Dc={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Ac(r,e,t){var s=this._calendar[r]||this._calendar.sameElse;return _t(s)?s.call(e,t):s}function Dt(r,e,t){var s=""+Math.abs(r),i=e-s.length,n=r>=0;return(n?t?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var Zi=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ms=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Xi={},br={};function Q(r,e,t,s){var i=s;typeof s=="string"&&(i=function(){return this[s]()}),r&&(br[r]=i),e&&(br[e[0]]=function(){return Dt(i.apply(this,arguments),e[1],e[2])}),t&&(br[t]=function(){return this.localeData().ordinal(i.apply(this,arguments),r)})}function Sc(r){return r.match(/\[[\s\S]/)?r.replace(/^\[|\]$/g,""):r.replace(/\\/g,"")}function Tc(r){var e=r.match(Zi),t,s;for(t=0,s=e.length;t<s;t++)br[e[t]]?e[t]=br[e[t]]:e[t]=Sc(e[t]);return function(i){var n="",a;for(a=0;a<s;a++)n+=_t(e[a])?e[a].call(i,r):e[a];return n}}function vs(r,e){return r.isValid()?(e=Ga(e,r.localeData()),Xi[e]=Xi[e]||Tc(e),Xi[e](r)):r.localeData().invalidDate()}function Ga(r,e){var t=5;function s(i){return e.longDateFormat(i)||i}for(ms.lastIndex=0;t>=0&&ms.test(r);)r=r.replace(ms,s),ms.lastIndex=0,t-=1;return r}var Rc={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Fc(r){var e=this._longDateFormat[r],t=this._longDateFormat[r.toUpperCase()];return e||!t?e:(this._longDateFormat[r]=t.match(Zi).map(function(s){return s==="MMMM"||s==="MM"||s==="DD"||s==="dddd"?s.slice(1):s}).join(""),this._longDateFormat[r])}var kc="Invalid date";function Bc(){return this._invalidDate}var Ic="%d",Hc=/\d{1,2}/;function Pc(r){return this._ordinal.replace("%d",r)}var $c={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Nc(r,e,t,s){var i=this._relativeTime[t];return _t(i)?i(r,e,t,s):i.replace(/%d/i,r)}function Oc(r,e){var t=this._relativeTime[r>0?"future":"past"];return _t(t)?t(e):t.replace(/%s/i,e)}var Va={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function nt(r){return typeof r=="string"?Va[r]||Va[r.toLowerCase()]:void 0}function Ji(r){var e={},t,s;for(s in r)ge(r,s)&&(t=nt(s),t&&(e[t]=r[s]));return e}var Mc={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function jc(r){var e=[],t;for(t in r)ge(r,t)&&e.push({unit:t,priority:Mc[t]});return e.sort(function(s,i){return s.priority-i.priority}),e}var za=/\d/,tt=/\d\d/,Ka=/\d{3}/,Qi=/\d{4}/,ys=/[+-]?\d{6}/,Ce=/\d\d?/,Za=/\d\d\d\d?/,Xa=/\d\d\d\d\d\d?/,ws=/\d{1,3}/,en=/\d{1,4}/,Es=/[+-]?\d{1,6}/,Cr=/\d+/,bs=/[+-]?\d+/,qc=/Z|[+-]\d\d:?\d\d/gi,Cs=/Z|[+-]\d\d(?::?\d\d)?/gi,Uc=/[+-]?\d+(\.\d{1,3})?/,Gr=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,_r=/^[1-9]\d?/,tn=/^([1-9]\d|\d)/,_s;_s={};function X(r,e,t){_s[r]=_t(e)?e:function(s,i){return s&&t?t:e}}function Lc(r,e){return ge(_s,r)?_s[r](e._strict,e._locale):new RegExp(Yc(r))}function Yc(r){return Ht(r.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,s,i,n){return t||s||i||n}))}function Ht(r){return r.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function at(r){return r<0?Math.ceil(r)||0:Math.floor(r)}function ae(r){var e=+r,t=0;return e!==0&&isFinite(e)&&(t=at(e)),t}var rn={};function ye(r,e){var t,s=e,i;for(typeof r=="string"&&(r=[r]),It(e)&&(s=function(n,a){a[e]=ae(n)}),i=r.length,t=0;t<i;t++)rn[r[t]]=s}function Vr(r,e){ye(r,function(t,s,i,n){i._w=i._w||{},e(t,i._w,i,n)})}function Wc(r,e,t){e!=null&&ge(rn,r)&&rn[r](e,t._a,t,r)}function Ds(r){return r%4===0&&r%100!==0||r%400===0}var Le=0,Pt=1,At=2,He=3,gt=4,$t=5,hr=6,Gc=7,Vc=8;Q("Y",0,0,function(){var r=this.year();return r<=9999?Dt(r,4):"+"+r}),Q(0,["YY",2],0,function(){return this.year()%100}),Q(0,["YYYY",4],0,"year"),Q(0,["YYYYY",5],0,"year"),Q(0,["YYYYYY",6,!0],0,"year"),X("Y",bs),X("YY",Ce,tt),X("YYYY",en,Qi),X("YYYYY",Es,ys),X("YYYYYY",Es,ys),ye(["YYYYY","YYYYYY"],Le),ye("YYYY",function(r,e){e[Le]=r.length===2?W.parseTwoDigitYear(r):ae(r)}),ye("YY",function(r,e){e[Le]=W.parseTwoDigitYear(r)}),ye("Y",function(r,e){e[Le]=parseInt(r,10)});function zr(r){return Ds(r)?366:365}W.parseTwoDigitYear=function(r){return ae(r)+(ae(r)>68?1900:2e3)};var Ja=Dr("FullYear",!0);function zc(){return Ds(this.year())}function Dr(r,e){return function(t){return t!=null?(Qa(this,r,t),W.updateOffset(this,e),this):Kr(this,r)}}function Kr(r,e){if(!r.isValid())return NaN;var t=r._d,s=r._isUTC;switch(e){case"Milliseconds":return s?t.getUTCMilliseconds():t.getMilliseconds();case"Seconds":return s?t.getUTCSeconds():t.getSeconds();case"Minutes":return s?t.getUTCMinutes():t.getMinutes();case"Hours":return s?t.getUTCHours():t.getHours();case"Date":return s?t.getUTCDate():t.getDate();case"Day":return s?t.getUTCDay():t.getDay();case"Month":return s?t.getUTCMonth():t.getMonth();case"FullYear":return s?t.getUTCFullYear():t.getFullYear();default:return NaN}}function Qa(r,e,t){var s,i,n,a,o;if(!(!r.isValid()||isNaN(t))){switch(s=r._d,i=r._isUTC,e){case"Milliseconds":return void(i?s.setUTCMilliseconds(t):s.setMilliseconds(t));case"Seconds":return void(i?s.setUTCSeconds(t):s.setSeconds(t));case"Minutes":return void(i?s.setUTCMinutes(t):s.setMinutes(t));case"Hours":return void(i?s.setUTCHours(t):s.setHours(t));case"Date":return void(i?s.setUTCDate(t):s.setDate(t));case"FullYear":break;default:return}n=t,a=r.month(),o=r.date(),o=o===29&&a===1&&!Ds(n)?28:o,i?s.setUTCFullYear(n,a,o):s.setFullYear(n,a,o)}}function Kc(r){return r=nt(r),_t(this[r])?this[r]():this}function Zc(r,e){if(typeof r=="object"){r=Ji(r);var t=jc(r),s,i=t.length;for(s=0;s<i;s++)this[t[s].unit](r[t[s].unit])}else if(r=nt(r),_t(this[r]))return this[r](e);return this}function Xc(r,e){return(r%e+e)%e}var Te;Array.prototype.indexOf?Te=Array.prototype.indexOf:Te=function(r){var e;for(e=0;e<this.length;++e)if(this[e]===r)return e;return-1};function sn(r,e){if(isNaN(r)||isNaN(e))return NaN;var t=Xc(e,12);return r+=(e-t)/12,t===1?Ds(r)?29:28:31-t%7%2}Q("M",["MM",2],"Mo",function(){return this.month()+1}),Q("MMM",0,0,function(r){return this.localeData().monthsShort(this,r)}),Q("MMMM",0,0,function(r){return this.localeData().months(this,r)}),X("M",Ce,_r),X("MM",Ce,tt),X("MMM",function(r,e){return e.monthsShortRegex(r)}),X("MMMM",function(r,e){return e.monthsRegex(r)}),ye(["M","MM"],function(r,e){e[Pt]=ae(r)-1}),ye(["MMM","MMMM"],function(r,e,t,s){var i=t._locale.monthsParse(r,s,t._strict);i!=null?e[Pt]=i:re(t).invalidMonth=r});var Jc="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),eo="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),to=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Qc=Gr,el=Gr;function tl(r,e){return r?ut(this._months)?this._months[r.month()]:this._months[(this._months.isFormat||to).test(e)?"format":"standalone"][r.month()]:ut(this._months)?this._months:this._months.standalone}function rl(r,e){return r?ut(this._monthsShort)?this._monthsShort[r.month()]:this._monthsShort[to.test(e)?"format":"standalone"][r.month()]:ut(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function sl(r,e,t){var s,i,n,a=r.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)n=Ct([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(n,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(n,"").toLocaleLowerCase();return t?e==="MMM"?(i=Te.call(this._shortMonthsParse,a),i!==-1?i:null):(i=Te.call(this._longMonthsParse,a),i!==-1?i:null):e==="MMM"?(i=Te.call(this._shortMonthsParse,a),i!==-1?i:(i=Te.call(this._longMonthsParse,a),i!==-1?i:null)):(i=Te.call(this._longMonthsParse,a),i!==-1?i:(i=Te.call(this._shortMonthsParse,a),i!==-1?i:null))}function il(r,e,t){var s,i,n;if(this._monthsParseExact)return sl.call(this,r,e,t);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=Ct([2e3,s]),t&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!t&&!this._monthsParse[s]&&(n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(n.replace(".",""),"i")),t&&e==="MMMM"&&this._longMonthsParse[s].test(r))return s;if(t&&e==="MMM"&&this._shortMonthsParse[s].test(r))return s;if(!t&&this._monthsParse[s].test(r))return s}}function ro(r,e){if(!r.isValid())return r;if(typeof e=="string"){if(/^\d+$/.test(e))e=ae(e);else if(e=r.localeData().monthsParse(e),!It(e))return r}var t=e,s=r.date();return s=s<29?s:Math.min(s,sn(r.year(),t)),r._isUTC?r._d.setUTCMonth(t,s):r._d.setMonth(t,s),r}function so(r){return r!=null?(ro(this,r),W.updateOffset(this,!0),this):Kr(this,"Month")}function nl(){return sn(this.year(),this.month())}function al(r){return this._monthsParseExact?(ge(this,"_monthsRegex")||io.call(this),r?this._monthsShortStrictRegex:this._monthsShortRegex):(ge(this,"_monthsShortRegex")||(this._monthsShortRegex=Qc),this._monthsShortStrictRegex&&r?this._monthsShortStrictRegex:this._monthsShortRegex)}function ol(r){return this._monthsParseExact?(ge(this,"_monthsRegex")||io.call(this),r?this._monthsStrictRegex:this._monthsRegex):(ge(this,"_monthsRegex")||(this._monthsRegex=el),this._monthsStrictRegex&&r?this._monthsStrictRegex:this._monthsRegex)}function io(){function r(d,c){return c.length-d.length}var e=[],t=[],s=[],i,n,a,o;for(i=0;i<12;i++)n=Ct([2e3,i]),a=Ht(this.monthsShort(n,"")),o=Ht(this.months(n,"")),e.push(a),t.push(o),s.push(o),s.push(a);e.sort(r),t.sort(r),s.sort(r),this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function cl(r,e,t,s,i,n,a){var o;return r<100&&r>=0?(o=new Date(r+400,e,t,s,i,n,a),isFinite(o.getFullYear())&&o.setFullYear(r)):o=new Date(r,e,t,s,i,n,a),o}function Zr(r){var e,t;return r<100&&r>=0?(t=Array.prototype.slice.call(arguments),t[0]=r+400,e=new Date(Date.UTC.apply(null,t)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(r)):e=new Date(Date.UTC.apply(null,arguments)),e}function As(r,e,t){var s=7+e-t,i=(7+Zr(r,0,s).getUTCDay()-e)%7;return-i+s-1}function no(r,e,t,s,i){var n=(7+t-s)%7,a=As(r,s,i),o=1+7*(e-1)+n+a,d,c;return o<=0?(d=r-1,c=zr(d)+o):o>zr(r)?(d=r+1,c=o-zr(r)):(d=r,c=o),{year:d,dayOfYear:c}}function Xr(r,e,t){var s=As(r.year(),e,t),i=Math.floor((r.dayOfYear()-s-1)/7)+1,n,a;return i<1?(a=r.year()-1,n=i+Nt(a,e,t)):i>Nt(r.year(),e,t)?(n=i-Nt(r.year(),e,t),a=r.year()+1):(a=r.year(),n=i),{week:n,year:a}}function Nt(r,e,t){var s=As(r,e,t),i=As(r+1,e,t);return(zr(r)-s+i)/7}Q("w",["ww",2],"wo","week"),Q("W",["WW",2],"Wo","isoWeek"),X("w",Ce,_r),X("ww",Ce,tt),X("W",Ce,_r),X("WW",Ce,tt),Vr(["w","ww","W","WW"],function(r,e,t,s){e[s.substr(0,1)]=ae(r)});function ll(r){return Xr(r,this._week.dow,this._week.doy).week}var dl={dow:0,doy:6};function hl(){return this._week.dow}function ul(){return this._week.doy}function fl(r){var e=this.localeData().week(this);return r==null?e:this.add((r-e)*7,"d")}function gl(r){var e=Xr(this,1,4).week;return r==null?e:this.add((r-e)*7,"d")}Q("d",0,"do","day"),Q("dd",0,0,function(r){return this.localeData().weekdaysMin(this,r)}),Q("ddd",0,0,function(r){return this.localeData().weekdaysShort(this,r)}),Q("dddd",0,0,function(r){return this.localeData().weekdays(this,r)}),Q("e",0,0,"weekday"),Q("E",0,0,"isoWeekday"),X("d",Ce),X("e",Ce),X("E",Ce),X("dd",function(r,e){return e.weekdaysMinRegex(r)}),X("ddd",function(r,e){return e.weekdaysShortRegex(r)}),X("dddd",function(r,e){return e.weekdaysRegex(r)}),Vr(["dd","ddd","dddd"],function(r,e,t,s){var i=t._locale.weekdaysParse(r,s,t._strict);i!=null?e.d=i:re(t).invalidWeekday=r}),Vr(["d","e","E"],function(r,e,t,s){e[s]=ae(r)});function xl(r,e){return typeof r!="string"?r:isNaN(r)?(r=e.weekdaysParse(r),typeof r=="number"?r:null):parseInt(r,10)}function pl(r,e){return typeof r=="string"?e.weekdaysParse(r)%7||7:isNaN(r)?null:r}function nn(r,e){return r.slice(e,7).concat(r.slice(0,e))}var ml="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ao="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),vl="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),yl=Gr,wl=Gr,El=Gr;function bl(r,e){var t=ut(this._weekdays)?this._weekdays:this._weekdays[r&&r!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return r===!0?nn(t,this._week.dow):r?t[r.day()]:t}function Cl(r){return r===!0?nn(this._weekdaysShort,this._week.dow):r?this._weekdaysShort[r.day()]:this._weekdaysShort}function _l(r){return r===!0?nn(this._weekdaysMin,this._week.dow):r?this._weekdaysMin[r.day()]:this._weekdaysMin}function Dl(r,e,t){var s,i,n,a=r.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)n=Ct([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(n,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(n,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(n,"").toLocaleLowerCase();return t?e==="dddd"?(i=Te.call(this._weekdaysParse,a),i!==-1?i:null):e==="ddd"?(i=Te.call(this._shortWeekdaysParse,a),i!==-1?i:null):(i=Te.call(this._minWeekdaysParse,a),i!==-1?i:null):e==="dddd"?(i=Te.call(this._weekdaysParse,a),i!==-1||(i=Te.call(this._shortWeekdaysParse,a),i!==-1)?i:(i=Te.call(this._minWeekdaysParse,a),i!==-1?i:null)):e==="ddd"?(i=Te.call(this._shortWeekdaysParse,a),i!==-1||(i=Te.call(this._weekdaysParse,a),i!==-1)?i:(i=Te.call(this._minWeekdaysParse,a),i!==-1?i:null)):(i=Te.call(this._minWeekdaysParse,a),i!==-1||(i=Te.call(this._weekdaysParse,a),i!==-1)?i:(i=Te.call(this._shortWeekdaysParse,a),i!==-1?i:null))}function Al(r,e,t){var s,i,n;if(this._weekdaysParseExact)return Dl.call(this,r,e,t);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=Ct([2e3,1]).day(s),t&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(n.replace(".",""),"i")),t&&e==="dddd"&&this._fullWeekdaysParse[s].test(r))return s;if(t&&e==="ddd"&&this._shortWeekdaysParse[s].test(r))return s;if(t&&e==="dd"&&this._minWeekdaysParse[s].test(r))return s;if(!t&&this._weekdaysParse[s].test(r))return s}}function Sl(r){if(!this.isValid())return r!=null?this:NaN;var e=Kr(this,"Day");return r!=null?(r=xl(r,this.localeData()),this.add(r-e,"d")):e}function Tl(r){if(!this.isValid())return r!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return r==null?e:this.add(r-e,"d")}function Rl(r){if(!this.isValid())return r!=null?this:NaN;if(r!=null){var e=pl(r,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function Fl(r){return this._weekdaysParseExact?(ge(this,"_weekdaysRegex")||an.call(this),r?this._weekdaysStrictRegex:this._weekdaysRegex):(ge(this,"_weekdaysRegex")||(this._weekdaysRegex=yl),this._weekdaysStrictRegex&&r?this._weekdaysStrictRegex:this._weekdaysRegex)}function kl(r){return this._weekdaysParseExact?(ge(this,"_weekdaysRegex")||an.call(this),r?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ge(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=wl),this._weekdaysShortStrictRegex&&r?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Bl(r){return this._weekdaysParseExact?(ge(this,"_weekdaysRegex")||an.call(this),r?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ge(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=El),this._weekdaysMinStrictRegex&&r?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function an(){function r(l,g){return g.length-l.length}var e=[],t=[],s=[],i=[],n,a,o,d,c;for(n=0;n<7;n++)a=Ct([2e3,1]).day(n),o=Ht(this.weekdaysMin(a,"")),d=Ht(this.weekdaysShort(a,"")),c=Ht(this.weekdays(a,"")),e.push(o),t.push(d),s.push(c),i.push(o),i.push(d),i.push(c);e.sort(r),t.sort(r),s.sort(r),i.sort(r),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function on(){return this.hours()%12||12}function Il(){return this.hours()||24}Q("H",["HH",2],0,"hour"),Q("h",["hh",2],0,on),Q("k",["kk",2],0,Il),Q("hmm",0,0,function(){return""+on.apply(this)+Dt(this.minutes(),2)}),Q("hmmss",0,0,function(){return""+on.apply(this)+Dt(this.minutes(),2)+Dt(this.seconds(),2)}),Q("Hmm",0,0,function(){return""+this.hours()+Dt(this.minutes(),2)}),Q("Hmmss",0,0,function(){return""+this.hours()+Dt(this.minutes(),2)+Dt(this.seconds(),2)});function oo(r,e){Q(r,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}oo("a",!0),oo("A",!1);function co(r,e){return e._meridiemParse}X("a",co),X("A",co),X("H",Ce,tn),X("h",Ce,_r),X("k",Ce,_r),X("HH",Ce,tt),X("hh",Ce,tt),X("kk",Ce,tt),X("hmm",Za),X("hmmss",Xa),X("Hmm",Za),X("Hmmss",Xa),ye(["H","HH"],He),ye(["k","kk"],function(r,e,t){var s=ae(r);e[He]=s===24?0:s}),ye(["a","A"],function(r,e,t){t._isPm=t._locale.isPM(r),t._meridiem=r}),ye(["h","hh"],function(r,e,t){e[He]=ae(r),re(t).bigHour=!0}),ye("hmm",function(r,e,t){var s=r.length-2;e[He]=ae(r.substr(0,s)),e[gt]=ae(r.substr(s)),re(t).bigHour=!0}),ye("hmmss",function(r,e,t){var s=r.length-4,i=r.length-2;e[He]=ae(r.substr(0,s)),e[gt]=ae(r.substr(s,2)),e[$t]=ae(r.substr(i)),re(t).bigHour=!0}),ye("Hmm",function(r,e,t){var s=r.length-2;e[He]=ae(r.substr(0,s)),e[gt]=ae(r.substr(s))}),ye("Hmmss",function(r,e,t){var s=r.length-4,i=r.length-2;e[He]=ae(r.substr(0,s)),e[gt]=ae(r.substr(s,2)),e[$t]=ae(r.substr(i))});function Hl(r){return(r+"").toLowerCase().charAt(0)==="p"}var Pl=/[ap]\.?m?\.?/i,$l=Dr("Hours",!0);function Nl(r,e,t){return r>11?t?"pm":"PM":t?"am":"AM"}var lo={calendar:Dc,longDateFormat:Rc,invalidDate:kc,ordinal:Ic,dayOfMonthOrdinalParse:Hc,relativeTime:$c,months:Jc,monthsShort:eo,week:dl,weekdays:ml,weekdaysMin:vl,weekdaysShort:ao,meridiemParse:Pl},De={},Jr={},Qr;function Ol(r,e){var t,s=Math.min(r.length,e.length);for(t=0;t<s;t+=1)if(r[t]!==e[t])return t;return s}function ho(r){return r&&r.toLowerCase().replace("_","-")}function Ml(r){for(var e=0,t,s,i,n;e<r.length;){for(n=ho(r[e]).split("-"),t=n.length,s=ho(r[e+1]),s=s?s.split("-"):null;t>0;){if(i=Ss(n.slice(0,t).join("-")),i)return i;if(s&&s.length>=t&&Ol(n,s)>=t-1)break;t--}e++}return Qr}function jl(r){return!!(r&&r.match("^[^/\\\\]*$"))}function Ss(r){var e=null,t;if(De[r]===void 0&&typeof module<"u"&&module&&module.exports&&jl(r))try{e=Qr._abbr,t=require,t("./locale/"+r),Jt(e)}catch{De[r]=null}return De[r]}function Jt(r,e){var t;return r&&(Ze(e)?t=Ot(r):t=cn(r,e),t?Qr=t:typeof console<"u"&&console.warn&&console.warn("Locale "+r+" not found. Did you forget to load it?")),Qr._abbr}function cn(r,e){if(e!==null){var t,s=lo;if(e.abbr=r,De[r]!=null)Wa("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=De[r]._config;else if(e.parentLocale!=null)if(De[e.parentLocale]!=null)s=De[e.parentLocale]._config;else if(t=Ss(e.parentLocale),t!=null)s=t._config;else return Jr[e.parentLocale]||(Jr[e.parentLocale]=[]),Jr[e.parentLocale].push({name:r,config:e}),null;return De[r]=new zi(Vi(s,e)),Jr[r]&&Jr[r].forEach(function(i){cn(i.name,i.config)}),Jt(r),De[r]}else return delete De[r],null}function ql(r,e){if(e!=null){var t,s,i=lo;De[r]!=null&&De[r].parentLocale!=null?De[r].set(Vi(De[r]._config,e)):(s=Ss(r),s!=null&&(i=s._config),e=Vi(i,e),s==null&&(e.abbr=r),t=new zi(e),t.parentLocale=De[r],De[r]=t),Jt(r)}else De[r]!=null&&(De[r].parentLocale!=null?(De[r]=De[r].parentLocale,r===Jt()&&Jt(r)):De[r]!=null&&delete De[r]);return De[r]}function Ot(r){var e;if(r&&r._locale&&r._locale._abbr&&(r=r._locale._abbr),!r)return Qr;if(!ut(r)){if(e=Ss(r),e)return e;r=[r]}return Ml(r)}function Ul(){return Ki(De)}function ln(r){var e,t=r._a;return t&&re(r).overflow===-2&&(e=t[Pt]<0||t[Pt]>11?Pt:t[At]<1||t[At]>sn(t[Le],t[Pt])?At:t[He]<0||t[He]>24||t[He]===24&&(t[gt]!==0||t[$t]!==0||t[hr]!==0)?He:t[gt]<0||t[gt]>59?gt:t[$t]<0||t[$t]>59?$t:t[hr]<0||t[hr]>999?hr:-1,re(r)._overflowDayOfYear&&(e<Le||e>At)&&(e=At),re(r)._overflowWeeks&&e===-1&&(e=Gc),re(r)._overflowWeekday&&e===-1&&(e=Vc),re(r).overflow=e),r}var Ll=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Yl=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Wl=/Z|[+-]\d\d(?::?\d\d)?/,Ts=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],dn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Gl=/^\/?Date\((-?\d+)/i,Vl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,zl={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function uo(r){var e,t,s=r._i,i=Ll.exec(s)||Yl.exec(s),n,a,o,d,c=Ts.length,l=dn.length;if(i){for(re(r).iso=!0,e=0,t=c;e<t;e++)if(Ts[e][1].exec(i[1])){a=Ts[e][0],n=Ts[e][2]!==!1;break}if(a==null){r._isValid=!1;return}if(i[3]){for(e=0,t=l;e<t;e++)if(dn[e][1].exec(i[3])){o=(i[2]||" ")+dn[e][0];break}if(o==null){r._isValid=!1;return}}if(!n&&o!=null){r._isValid=!1;return}if(i[4])if(Wl.exec(i[4]))d="Z";else{r._isValid=!1;return}r._f=a+(o||"")+(d||""),un(r)}else r._isValid=!1}function Kl(r,e,t,s,i,n){var a=[Zl(r),eo.indexOf(e),parseInt(t,10),parseInt(s,10),parseInt(i,10)];return n&&a.push(parseInt(n,10)),a}function Zl(r){var e=parseInt(r,10);return e<=49?2e3+e:e<=999?1900+e:e}function Xl(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Jl(r,e,t){if(r){var s=ao.indexOf(r),i=new Date(e[0],e[1],e[2]).getDay();if(s!==i)return re(t).weekdayMismatch=!0,t._isValid=!1,!1}return!0}function Ql(r,e,t){if(r)return zl[r];if(e)return 0;var s=parseInt(t,10),i=s%100,n=(s-i)/100;return n*60+i}function fo(r){var e=Vl.exec(Xl(r._i)),t;if(e){if(t=Kl(e[4],e[3],e[2],e[5],e[6],e[7]),!Jl(e[1],t,r))return;r._a=t,r._tzm=Ql(e[8],e[9],e[10]),r._d=Zr.apply(null,r._a),r._d.setUTCMinutes(r._d.getUTCMinutes()-r._tzm),re(r).rfc2822=!0}else r._isValid=!1}function ed(r){var e=Gl.exec(r._i);if(e!==null){r._d=new Date(+e[1]);return}if(uo(r),r._isValid===!1)delete r._isValid;else return;if(fo(r),r._isValid===!1)delete r._isValid;else return;r._strict?r._isValid=!1:W.createFromInputFallback(r)}W.createFromInputFallback=it("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(r){r._d=new Date(r._i+(r._useUTC?" UTC":""))});function Ar(r,e,t){return r??e??t}function td(r){var e=new Date(W.now());return r._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function hn(r){var e,t,s=[],i,n,a;if(!r._d){for(i=td(r),r._w&&r._a[At]==null&&r._a[Pt]==null&&rd(r),r._dayOfYear!=null&&(a=Ar(r._a[Le],i[Le]),(r._dayOfYear>zr(a)||r._dayOfYear===0)&&(re(r)._overflowDayOfYear=!0),t=Zr(a,0,r._dayOfYear),r._a[Pt]=t.getUTCMonth(),r._a[At]=t.getUTCDate()),e=0;e<3&&r._a[e]==null;++e)r._a[e]=s[e]=i[e];for(;e<7;e++)r._a[e]=s[e]=r._a[e]==null?e===2?1:0:r._a[e];r._a[He]===24&&r._a[gt]===0&&r._a[$t]===0&&r._a[hr]===0&&(r._nextDay=!0,r._a[He]=0),r._d=(r._useUTC?Zr:cl).apply(null,s),n=r._useUTC?r._d.getUTCDay():r._d.getDay(),r._tzm!=null&&r._d.setUTCMinutes(r._d.getUTCMinutes()-r._tzm),r._nextDay&&(r._a[He]=24),r._w&&typeof r._w.d<"u"&&r._w.d!==n&&(re(r).weekdayMismatch=!0)}}function rd(r){var e,t,s,i,n,a,o,d,c;e=r._w,e.GG!=null||e.W!=null||e.E!=null?(n=1,a=4,t=Ar(e.GG,r._a[Le],Xr(_e(),1,4).year),s=Ar(e.W,1),i=Ar(e.E,1),(i<1||i>7)&&(d=!0)):(n=r._locale._week.dow,a=r._locale._week.doy,c=Xr(_e(),n,a),t=Ar(e.gg,r._a[Le],c.year),s=Ar(e.w,c.week),e.d!=null?(i=e.d,(i<0||i>6)&&(d=!0)):e.e!=null?(i=e.e+n,(e.e<0||e.e>6)&&(d=!0)):i=n),s<1||s>Nt(t,n,a)?re(r)._overflowWeeks=!0:d!=null?re(r)._overflowWeekday=!0:(o=no(t,s,i,n,a),r._a[Le]=o.year,r._dayOfYear=o.dayOfYear)}W.ISO_8601=function(){},W.RFC_2822=function(){};function un(r){if(r._f===W.ISO_8601){uo(r);return}if(r._f===W.RFC_2822){fo(r);return}r._a=[],re(r).empty=!0;var e=""+r._i,t,s,i,n,a,o=e.length,d=0,c,l;for(i=Ga(r._f,r._locale).match(Zi)||[],l=i.length,t=0;t<l;t++)n=i[t],s=(e.match(Lc(n,r))||[])[0],s&&(a=e.substr(0,e.indexOf(s)),a.length>0&&re(r).unusedInput.push(a),e=e.slice(e.indexOf(s)+s.length),d+=s.length),br[n]?(s?re(r).empty=!1:re(r).unusedTokens.push(n),Wc(n,s,r)):r._strict&&!s&&re(r).unusedTokens.push(n);re(r).charsLeftOver=o-d,e.length>0&&re(r).unusedInput.push(e),r._a[He]<=12&&re(r).bigHour===!0&&r._a[He]>0&&(re(r).bigHour=void 0),re(r).parsedDateParts=r._a.slice(0),re(r).meridiem=r._meridiem,r._a[He]=sd(r._locale,r._a[He],r._meridiem),c=re(r).era,c!==null&&(r._a[Le]=r._locale.erasConvertYear(c,r._a[Le])),hn(r),ln(r)}function sd(r,e,t){var s;return t==null?e:r.meridiemHour!=null?r.meridiemHour(e,t):(r.isPM!=null&&(s=r.isPM(t),s&&e<12&&(e+=12),!s&&e===12&&(e=0)),e)}function id(r){var e,t,s,i,n,a,o=!1,d=r._f.length;if(d===0){re(r).invalidFormat=!0,r._d=new Date(NaN);return}for(i=0;i<d;i++)n=0,a=!1,e=Gi({},r),r._useUTC!=null&&(e._useUTC=r._useUTC),e._f=r._f[i],un(e),Yi(e)&&(a=!0),n+=re(e).charsLeftOver,n+=re(e).unusedTokens.length*10,re(e).score=n,o?n<s&&(s=n,t=e):(s==null||n<s||a)&&(s=n,t=e,a&&(o=!0));Xt(r,t||e)}function nd(r){if(!r._d){var e=Ji(r._i),t=e.day===void 0?e.date:e.day;r._a=qa([e.year,e.month,t,e.hour,e.minute,e.second,e.millisecond],function(s){return s&&parseInt(s,10)}),hn(r)}}function ad(r){var e=new Wr(ln(go(r)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function go(r){var e=r._i,t=r._f;return r._locale=r._locale||Ot(r._l),e===null||t===void 0&&e===""?ps({nullInput:!0}):(typeof e=="string"&&(r._i=e=r._locale.preparse(e)),ft(e)?new Wr(ln(e)):(Yr(e)?r._d=e:ut(t)?id(r):t?un(r):od(r),Yi(r)||(r._d=null),r))}function od(r){var e=r._i;Ze(e)?r._d=new Date(W.now()):Yr(e)?r._d=new Date(e.valueOf()):typeof e=="string"?ed(r):ut(e)?(r._a=qa(e.slice(0),function(t){return parseInt(t,10)}),hn(r)):dr(e)?nd(r):It(e)?r._d=new Date(e):W.createFromInputFallback(r)}function xo(r,e,t,s,i){var n={};return(e===!0||e===!1)&&(s=e,e=void 0),(t===!0||t===!1)&&(s=t,t=void 0),(dr(r)&&Ui(r)||ut(r)&&r.length===0)&&(r=void 0),n._isAMomentObject=!0,n._useUTC=n._isUTC=i,n._l=t,n._i=r,n._f=e,n._strict=s,ad(n)}function _e(r,e,t,s){return xo(r,e,t,s,!1)}var cd=it("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var r=_e.apply(null,arguments);return this.isValid()&&r.isValid()?r<this?this:r:ps()}),ld=it("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var r=_e.apply(null,arguments);return this.isValid()&&r.isValid()?r>this?this:r:ps()});function po(r,e){var t,s;if(e.length===1&&ut(e[0])&&(e=e[0]),!e.length)return _e();for(t=e[0],s=1;s<e.length;++s)(!e[s].isValid()||e[s][r](t))&&(t=e[s]);return t}function dd(){var r=[].slice.call(arguments,0);return po("isBefore",r)}function hd(){var r=[].slice.call(arguments,0);return po("isAfter",r)}var ud=function(){return Date.now?Date.now():+new Date},es=["year","quarter","month","week","day","hour","minute","second","millisecond"];function fd(r){var e,t=!1,s,i=es.length;for(e in r)if(ge(r,e)&&!(Te.call(es,e)!==-1&&(r[e]==null||!isNaN(r[e]))))return!1;for(s=0;s<i;++s)if(r[es[s]]){if(t)return!1;parseFloat(r[es[s]])!==ae(r[es[s]])&&(t=!0)}return!0}function gd(){return this._isValid}function xd(){return xt(NaN)}function Rs(r){var e=Ji(r),t=e.year||0,s=e.quarter||0,i=e.month||0,n=e.week||e.isoWeek||0,a=e.day||0,o=e.hour||0,d=e.minute||0,c=e.second||0,l=e.millisecond||0;this._isValid=fd(e),this._milliseconds=+l+c*1e3+d*6e4+o*1e3*60*60,this._days=+a+n*7,this._months=+i+s*3+t*12,this._data={},this._locale=Ot(),this._bubble()}function Fs(r){return r instanceof Rs}function fn(r){return r<0?Math.round(-1*r)*-1:Math.round(r)}function pd(r,e,t){var s=Math.min(r.length,e.length),i=Math.abs(r.length-e.length),n=0,a;for(a=0;a<s;a++)ae(r[a])!==ae(e[a])&&n++;return n+i}function mo(r,e){Q(r,0,0,function(){var t=this.utcOffset(),s="+";return t<0&&(t=-t,s="-"),s+Dt(~~(t/60),2)+e+Dt(~~t%60,2)})}mo("Z",":"),mo("ZZ",""),X("Z",Cs),X("ZZ",Cs),ye(["Z","ZZ"],function(r,e,t){t._useUTC=!0,t._tzm=gn(Cs,r)});var md=/([\+\-]|\d\d)/gi;function gn(r,e){var t=(e||"").match(r),s,i,n;return t===null?null:(s=t[t.length-1]||[],i=(s+"").match(md)||["-",0,0],n=+(i[1]*60)+ae(i[2]),n===0?0:i[0]==="+"?n:-n)}function xn(r,e){var t,s;return e._isUTC?(t=e.clone(),s=(ft(r)||Yr(r)?r.valueOf():_e(r).valueOf())-t.valueOf(),t._d.setTime(t._d.valueOf()+s),W.updateOffset(t,!1),t):_e(r).local()}function pn(r){return-Math.round(r._d.getTimezoneOffset())}W.updateOffset=function(){};function vd(r,e,t){var s=this._offset||0,i;if(!this.isValid())return r!=null?this:NaN;if(r!=null){if(typeof r=="string"){if(r=gn(Cs,r),r===null)return this}else Math.abs(r)<16&&!t&&(r=r*60);return!this._isUTC&&e&&(i=pn(this)),this._offset=r,this._isUTC=!0,i!=null&&this.add(i,"m"),s!==r&&(!e||this._changeInProgress?Eo(this,xt(r-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,W.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?s:pn(this)}function yd(r,e){return r!=null?(typeof r!="string"&&(r=-r),this.utcOffset(r,e),this):-this.utcOffset()}function wd(r){return this.utcOffset(0,r)}function Ed(r){return this._isUTC&&(this.utcOffset(0,r),this._isUTC=!1,r&&this.subtract(pn(this),"m")),this}function bd(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var r=gn(qc,this._i);r!=null?this.utcOffset(r):this.utcOffset(0,!0)}return this}function Cd(r){return this.isValid()?(r=r?_e(r).utcOffset():0,(this.utcOffset()-r)%60===0):!1}function _d(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Dd(){if(!Ze(this._isDSTShifted))return this._isDSTShifted;var r={},e;return Gi(r,this),r=go(r),r._a?(e=r._isUTC?Ct(r._a):_e(r._a),this._isDSTShifted=this.isValid()&&pd(r._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Ad(){return this.isValid()?!this._isUTC:!1}function Sd(){return this.isValid()?this._isUTC:!1}function vo(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Td=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Rd=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function xt(r,e){var t=r,s=null,i,n,a;return Fs(r)?t={ms:r._milliseconds,d:r._days,M:r._months}:It(r)||!isNaN(+r)?(t={},e?t[e]=+r:t.milliseconds=+r):(s=Td.exec(r))?(i=s[1]==="-"?-1:1,t={y:0,d:ae(s[At])*i,h:ae(s[He])*i,m:ae(s[gt])*i,s:ae(s[$t])*i,ms:ae(fn(s[hr]*1e3))*i}):(s=Rd.exec(r))?(i=s[1]==="-"?-1:1,t={y:ur(s[2],i),M:ur(s[3],i),w:ur(s[4],i),d:ur(s[5],i),h:ur(s[6],i),m:ur(s[7],i),s:ur(s[8],i)}):t==null?t={}:typeof t=="object"&&("from"in t||"to"in t)&&(a=Fd(_e(t.from),_e(t.to)),t={},t.ms=a.milliseconds,t.M=a.months),n=new Rs(t),Fs(r)&&ge(r,"_locale")&&(n._locale=r._locale),Fs(r)&&ge(r,"_isValid")&&(n._isValid=r._isValid),n}xt.fn=Rs.prototype,xt.invalid=xd;function ur(r,e){var t=r&&parseFloat(r.replace(",","."));return(isNaN(t)?0:t)*e}function yo(r,e){var t={};return t.months=e.month()-r.month()+(e.year()-r.year())*12,r.clone().add(t.months,"M").isAfter(e)&&--t.months,t.milliseconds=+e-+r.clone().add(t.months,"M"),t}function Fd(r,e){var t;return r.isValid()&&e.isValid()?(e=xn(e,r),r.isBefore(e)?t=yo(r,e):(t=yo(e,r),t.milliseconds=-t.milliseconds,t.months=-t.months),t):{milliseconds:0,months:0}}function wo(r,e){return function(t,s){var i,n;return s!==null&&!isNaN(+s)&&(Wa(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=t,t=s,s=n),i=xt(t,s),Eo(this,i,r),this}}function Eo(r,e,t,s){var i=e._milliseconds,n=fn(e._days),a=fn(e._months);r.isValid()&&(s=s??!0,a&&ro(r,Kr(r,"Month")+a*t),n&&Qa(r,"Date",Kr(r,"Date")+n*t),i&&r._d.setTime(r._d.valueOf()+i*t),s&&W.updateOffset(r,n||a))}var kd=wo(1,"add"),Bd=wo(-1,"subtract");function bo(r){return typeof r=="string"||r instanceof String}function Id(r){return ft(r)||Yr(r)||bo(r)||It(r)||Pd(r)||Hd(r)||r===null||r===void 0}function Hd(r){var e=dr(r)&&!Ui(r),t=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,n,a=s.length;for(i=0;i<a;i+=1)n=s[i],t=t||ge(r,n);return e&&t}function Pd(r){var e=ut(r),t=!1;return e&&(t=r.filter(function(s){return!It(s)&&bo(r)}).length===0),e&&t}function $d(r){var e=dr(r)&&!Ui(r),t=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,n;for(i=0;i<s.length;i+=1)n=s[i],t=t||ge(r,n);return e&&t}function Nd(r,e){var t=r.diff(e,"days",!0);return t<-6?"sameElse":t<-1?"lastWeek":t<0?"lastDay":t<1?"sameDay":t<2?"nextDay":t<7?"nextWeek":"sameElse"}function Od(r,e){arguments.length===1&&(arguments[0]?Id(arguments[0])?(r=arguments[0],e=void 0):$d(arguments[0])&&(e=arguments[0],r=void 0):(r=void 0,e=void 0));var t=r||_e(),s=xn(t,this).startOf("day"),i=W.calendarFormat(this,s)||"sameElse",n=e&&(_t(e[i])?e[i].call(this,t):e[i]);return this.format(n||this.localeData().calendar(i,this,_e(t)))}function Md(){return new Wr(this)}function jd(r,e){var t=ft(r)?r:_e(r);return this.isValid()&&t.isValid()?(e=nt(e)||"millisecond",e==="millisecond"?this.valueOf()>t.valueOf():t.valueOf()<this.clone().startOf(e).valueOf()):!1}function qd(r,e){var t=ft(r)?r:_e(r);return this.isValid()&&t.isValid()?(e=nt(e)||"millisecond",e==="millisecond"?this.valueOf()<t.valueOf():this.clone().endOf(e).valueOf()<t.valueOf()):!1}function Ud(r,e,t,s){var i=ft(r)?r:_e(r),n=ft(e)?e:_e(e);return this.isValid()&&i.isValid()&&n.isValid()?(s=s||"()",(s[0]==="("?this.isAfter(i,t):!this.isBefore(i,t))&&(s[1]===")"?this.isBefore(n,t):!this.isAfter(n,t))):!1}function Ld(r,e){var t=ft(r)?r:_e(r),s;return this.isValid()&&t.isValid()?(e=nt(e)||"millisecond",e==="millisecond"?this.valueOf()===t.valueOf():(s=t.valueOf(),this.clone().startOf(e).valueOf()<=s&&s<=this.clone().endOf(e).valueOf())):!1}function Yd(r,e){return this.isSame(r,e)||this.isAfter(r,e)}function Wd(r,e){return this.isSame(r,e)||this.isBefore(r,e)}function Gd(r,e,t){var s,i,n;if(!this.isValid())return NaN;if(s=xn(r,this),!s.isValid())return NaN;switch(i=(s.utcOffset()-this.utcOffset())*6e4,e=nt(e),e){case"year":n=ks(this,s)/12;break;case"month":n=ks(this,s);break;case"quarter":n=ks(this,s)/3;break;case"second":n=(this-s)/1e3;break;case"minute":n=(this-s)/6e4;break;case"hour":n=(this-s)/36e5;break;case"day":n=(this-s-i)/864e5;break;case"week":n=(this-s-i)/6048e5;break;default:n=this-s}return t?n:at(n)}function ks(r,e){if(r.date()<e.date())return-ks(e,r);var t=(e.year()-r.year())*12+(e.month()-r.month()),s=r.clone().add(t,"months"),i,n;return e-s<0?(i=r.clone().add(t-1,"months"),n=(e-s)/(s-i)):(i=r.clone().add(t+1,"months"),n=(e-s)/(i-s)),-(t+n)||0}W.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",W.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Vd(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function zd(r){if(!this.isValid())return null;var e=r!==!0,t=e?this.clone().utc():this;return t.year()<0||t.year()>9999?vs(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):_t(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",vs(t,"Z")):vs(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Kd(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var r="moment",e="",t,s,i,n;return this.isLocal()||(r=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),t="["+r+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",n=e+'[")]',this.format(t+s+i+n)}function Zd(r){r||(r=this.isUtc()?W.defaultFormatUtc:W.defaultFormat);var e=vs(this,r);return this.localeData().postformat(e)}function Xd(r,e){return this.isValid()&&(ft(r)&&r.isValid()||_e(r).isValid())?xt({to:this,from:r}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function Jd(r){return this.from(_e(),r)}function Qd(r,e){return this.isValid()&&(ft(r)&&r.isValid()||_e(r).isValid())?xt({from:this,to:r}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function eh(r){return this.to(_e(),r)}function Co(r){var e;return r===void 0?this._locale._abbr:(e=Ot(r),e!=null&&(this._locale=e),this)}var _o=it("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(r){return r===void 0?this.localeData():this.locale(r)});function Do(){return this._locale}var Bs=1e3,Sr=60*Bs,Is=60*Sr,Ao=(365*400+97)*24*Is;function Tr(r,e){return(r%e+e)%e}function So(r,e,t){return r<100&&r>=0?new Date(r+400,e,t)-Ao:new Date(r,e,t).valueOf()}function To(r,e,t){return r<100&&r>=0?Date.UTC(r+400,e,t)-Ao:Date.UTC(r,e,t)}function th(r){var e,t;if(r=nt(r),r===void 0||r==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?To:So,r){case"year":e=t(this.year(),0,1);break;case"quarter":e=t(this.year(),this.month()-this.month()%3,1);break;case"month":e=t(this.year(),this.month(),1);break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=t(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=Tr(e+(this._isUTC?0:this.utcOffset()*Sr),Is);break;case"minute":e=this._d.valueOf(),e-=Tr(e,Sr);break;case"second":e=this._d.valueOf(),e-=Tr(e,Bs);break}return this._d.setTime(e),W.updateOffset(this,!0),this}function rh(r){var e,t;if(r=nt(r),r===void 0||r==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?To:So,r){case"year":e=t(this.year()+1,0,1)-1;break;case"quarter":e=t(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=t(this.year(),this.month()+1,1)-1;break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=t(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=Is-Tr(e+(this._isUTC?0:this.utcOffset()*Sr),Is)-1;break;case"minute":e=this._d.valueOf(),e+=Sr-Tr(e,Sr)-1;break;case"second":e=this._d.valueOf(),e+=Bs-Tr(e,Bs)-1;break}return this._d.setTime(e),W.updateOffset(this,!0),this}function sh(){return this._d.valueOf()-(this._offset||0)*6e4}function ih(){return Math.floor(this.valueOf()/1e3)}function nh(){return new Date(this.valueOf())}function ah(){var r=this;return[r.year(),r.month(),r.date(),r.hour(),r.minute(),r.second(),r.millisecond()]}function oh(){var r=this;return{years:r.year(),months:r.month(),date:r.date(),hours:r.hours(),minutes:r.minutes(),seconds:r.seconds(),milliseconds:r.milliseconds()}}function ch(){return this.isValid()?this.toISOString():null}function lh(){return Yi(this)}function dh(){return Xt({},re(this))}function hh(){return re(this).overflow}function uh(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Q("N",0,0,"eraAbbr"),Q("NN",0,0,"eraAbbr"),Q("NNN",0,0,"eraAbbr"),Q("NNNN",0,0,"eraName"),Q("NNNNN",0,0,"eraNarrow"),Q("y",["y",1],"yo","eraYear"),Q("y",["yy",2],0,"eraYear"),Q("y",["yyy",3],0,"eraYear"),Q("y",["yyyy",4],0,"eraYear"),X("N",mn),X("NN",mn),X("NNN",mn),X("NNNN",Ch),X("NNNNN",_h),ye(["N","NN","NNN","NNNN","NNNNN"],function(r,e,t,s){var i=t._locale.erasParse(r,s,t._strict);i?re(t).era=i:re(t).invalidEra=r}),X("y",Cr),X("yy",Cr),X("yyy",Cr),X("yyyy",Cr),X("yo",Dh),ye(["y","yy","yyy","yyyy"],Le),ye(["yo"],function(r,e,t,s){var i;t._locale._eraYearOrdinalRegex&&(i=r.match(t._locale._eraYearOrdinalRegex)),t._locale.eraYearOrdinalParse?e[Le]=t._locale.eraYearOrdinalParse(r,i):e[Le]=parseInt(r,10)});function fh(r,e){var t,s,i,n=this._eras||Ot("en")._eras;for(t=0,s=n.length;t<s;++t){switch(typeof n[t].since){case"string":i=W(n[t].since).startOf("day"),n[t].since=i.valueOf();break}switch(typeof n[t].until){case"undefined":n[t].until=1/0;break;case"string":i=W(n[t].until).startOf("day").valueOf(),n[t].until=i.valueOf();break}}return n}function gh(r,e,t){var s,i,n=this.eras(),a,o,d;for(r=r.toUpperCase(),s=0,i=n.length;s<i;++s)if(a=n[s].name.toUpperCase(),o=n[s].abbr.toUpperCase(),d=n[s].narrow.toUpperCase(),t)switch(e){case"N":case"NN":case"NNN":if(o===r)return n[s];break;case"NNNN":if(a===r)return n[s];break;case"NNNNN":if(d===r)return n[s];break}else if([a,o,d].indexOf(r)>=0)return n[s]}function xh(r,e){var t=r.since<=r.until?1:-1;return e===void 0?W(r.since).year():W(r.since).year()+(e-r.offset)*t}function ph(){var r,e,t,s=this.localeData().eras();for(r=0,e=s.length;r<e;++r)if(t=this.clone().startOf("day").valueOf(),s[r].since<=t&&t<=s[r].until||s[r].until<=t&&t<=s[r].since)return s[r].name;return""}function mh(){var r,e,t,s=this.localeData().eras();for(r=0,e=s.length;r<e;++r)if(t=this.clone().startOf("day").valueOf(),s[r].since<=t&&t<=s[r].until||s[r].until<=t&&t<=s[r].since)return s[r].narrow;return""}function vh(){var r,e,t,s=this.localeData().eras();for(r=0,e=s.length;r<e;++r)if(t=this.clone().startOf("day").valueOf(),s[r].since<=t&&t<=s[r].until||s[r].until<=t&&t<=s[r].since)return s[r].abbr;return""}function yh(){var r,e,t,s,i=this.localeData().eras();for(r=0,e=i.length;r<e;++r)if(t=i[r].since<=i[r].until?1:-1,s=this.clone().startOf("day").valueOf(),i[r].since<=s&&s<=i[r].until||i[r].until<=s&&s<=i[r].since)return(this.year()-W(i[r].since).year())*t+i[r].offset;return this.year()}function wh(r){return ge(this,"_erasNameRegex")||vn.call(this),r?this._erasNameRegex:this._erasRegex}function Eh(r){return ge(this,"_erasAbbrRegex")||vn.call(this),r?this._erasAbbrRegex:this._erasRegex}function bh(r){return ge(this,"_erasNarrowRegex")||vn.call(this),r?this._erasNarrowRegex:this._erasRegex}function mn(r,e){return e.erasAbbrRegex(r)}function Ch(r,e){return e.erasNameRegex(r)}function _h(r,e){return e.erasNarrowRegex(r)}function Dh(r,e){return e._eraYearOrdinalRegex||Cr}function vn(){var r=[],e=[],t=[],s=[],i,n,a,o,d,c=this.eras();for(i=0,n=c.length;i<n;++i)a=Ht(c[i].name),o=Ht(c[i].abbr),d=Ht(c[i].narrow),e.push(a),r.push(o),t.push(d),s.push(a),s.push(o),s.push(d);this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+t.join("|")+")","i")}Q(0,["gg",2],0,function(){return this.weekYear()%100}),Q(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Hs(r,e){Q(0,[r,r.length],0,e)}Hs("gggg","weekYear"),Hs("ggggg","weekYear"),Hs("GGGG","isoWeekYear"),Hs("GGGGG","isoWeekYear"),X("G",bs),X("g",bs),X("GG",Ce,tt),X("gg",Ce,tt),X("GGGG",en,Qi),X("gggg",en,Qi),X("GGGGG",Es,ys),X("ggggg",Es,ys),Vr(["gggg","ggggg","GGGG","GGGGG"],function(r,e,t,s){e[s.substr(0,2)]=ae(r)}),Vr(["gg","GG"],function(r,e,t,s){e[s]=W.parseTwoDigitYear(r)});function Ah(r){return Ro.call(this,r,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Sh(r){return Ro.call(this,r,this.isoWeek(),this.isoWeekday(),1,4)}function Th(){return Nt(this.year(),1,4)}function Rh(){return Nt(this.isoWeekYear(),1,4)}function Fh(){var r=this.localeData()._week;return Nt(this.year(),r.dow,r.doy)}function kh(){var r=this.localeData()._week;return Nt(this.weekYear(),r.dow,r.doy)}function Ro(r,e,t,s,i){var n;return r==null?Xr(this,s,i).year:(n=Nt(r,s,i),e>n&&(e=n),Bh.call(this,r,e,t,s,i))}function Bh(r,e,t,s,i){var n=no(r,e,t,s,i),a=Zr(n.year,0,n.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}Q("Q",0,"Qo","quarter"),X("Q",za),ye("Q",function(r,e){e[Pt]=(ae(r)-1)*3});function Ih(r){return r==null?Math.ceil((this.month()+1)/3):this.month((r-1)*3+this.month()%3)}Q("D",["DD",2],"Do","date"),X("D",Ce,_r),X("DD",Ce,tt),X("Do",function(r,e){return r?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),ye(["D","DD"],At),ye("Do",function(r,e){e[At]=ae(r.match(Ce)[0])});var Fo=Dr("Date",!0);Q("DDD",["DDDD",3],"DDDo","dayOfYear"),X("DDD",ws),X("DDDD",Ka),ye(["DDD","DDDD"],function(r,e,t){t._dayOfYear=ae(r)});function Hh(r){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return r==null?e:this.add(r-e,"d")}Q("m",["mm",2],0,"minute"),X("m",Ce,tn),X("mm",Ce,tt),ye(["m","mm"],gt);var Ph=Dr("Minutes",!1);Q("s",["ss",2],0,"second"),X("s",Ce,tn),X("ss",Ce,tt),ye(["s","ss"],$t);var $h=Dr("Seconds",!1);Q("S",0,0,function(){return~~(this.millisecond()/100)}),Q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Q(0,["SSS",3],0,"millisecond"),Q(0,["SSSS",4],0,function(){return this.millisecond()*10}),Q(0,["SSSSS",5],0,function(){return this.millisecond()*100}),Q(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),Q(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),Q(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),Q(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),X("S",ws,za),X("SS",ws,tt),X("SSS",ws,Ka);var Qt,ko;for(Qt="SSSS";Qt.length<=9;Qt+="S")X(Qt,Cr);function Nh(r,e){e[hr]=ae(("0."+r)*1e3)}for(Qt="S";Qt.length<=9;Qt+="S")ye(Qt,Nh);ko=Dr("Milliseconds",!1),Q("z",0,0,"zoneAbbr"),Q("zz",0,0,"zoneName");function Oh(){return this._isUTC?"UTC":""}function Mh(){return this._isUTC?"Coordinated Universal Time":""}var M=Wr.prototype;M.add=kd,M.calendar=Od,M.clone=Md,M.diff=Gd,M.endOf=rh,M.format=Zd,M.from=Xd,M.fromNow=Jd,M.to=Qd,M.toNow=eh,M.get=Kc,M.invalidAt=hh,M.isAfter=jd,M.isBefore=qd,M.isBetween=Ud,M.isSame=Ld,M.isSameOrAfter=Yd,M.isSameOrBefore=Wd,M.isValid=lh,M.lang=_o,M.locale=Co,M.localeData=Do,M.max=ld,M.min=cd,M.parsingFlags=dh,M.set=Zc,M.startOf=th,M.subtract=Bd,M.toArray=ah,M.toObject=oh,M.toDate=nh,M.toISOString=zd,M.inspect=Kd,typeof Symbol<"u"&&Symbol.for!=null&&(M[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),M.toJSON=ch,M.toString=Vd,M.unix=ih,M.valueOf=sh,M.creationData=uh,M.eraName=ph,M.eraNarrow=mh,M.eraAbbr=vh,M.eraYear=yh,M.year=Ja,M.isLeapYear=zc,M.weekYear=Ah,M.isoWeekYear=Sh,M.quarter=M.quarters=Ih,M.month=so,M.daysInMonth=nl,M.week=M.weeks=fl,M.isoWeek=M.isoWeeks=gl,M.weeksInYear=Fh,M.weeksInWeekYear=kh,M.isoWeeksInYear=Th,M.isoWeeksInISOWeekYear=Rh,M.date=Fo,M.day=M.days=Sl,M.weekday=Tl,M.isoWeekday=Rl,M.dayOfYear=Hh,M.hour=M.hours=$l,M.minute=M.minutes=Ph,M.second=M.seconds=$h,M.millisecond=M.milliseconds=ko,M.utcOffset=vd,M.utc=wd,M.local=Ed,M.parseZone=bd,M.hasAlignedHourOffset=Cd,M.isDST=_d,M.isLocal=Ad,M.isUtcOffset=Sd,M.isUtc=vo,M.isUTC=vo,M.zoneAbbr=Oh,M.zoneName=Mh,M.dates=it("dates accessor is deprecated. Use date instead.",Fo),M.months=it("months accessor is deprecated. Use month instead",so),M.years=it("years accessor is deprecated. Use year instead",Ja),M.zone=it("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",yd),M.isDSTShifted=it("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Dd);function jh(r){return _e(r*1e3)}function qh(){return _e.apply(null,arguments).parseZone()}function Bo(r){return r}var xe=zi.prototype;xe.calendar=Ac,xe.longDateFormat=Fc,xe.invalidDate=Bc,xe.ordinal=Pc,xe.preparse=Bo,xe.postformat=Bo,xe.relativeTime=Nc,xe.pastFuture=Oc,xe.set=_c,xe.eras=fh,xe.erasParse=gh,xe.erasConvertYear=xh,xe.erasAbbrRegex=Eh,xe.erasNameRegex=wh,xe.erasNarrowRegex=bh,xe.months=tl,xe.monthsShort=rl,xe.monthsParse=il,xe.monthsRegex=ol,xe.monthsShortRegex=al,xe.week=ll,xe.firstDayOfYear=ul,xe.firstDayOfWeek=hl,xe.weekdays=bl,xe.weekdaysMin=_l,xe.weekdaysShort=Cl,xe.weekdaysParse=Al,xe.weekdaysRegex=Fl,xe.weekdaysShortRegex=kl,xe.weekdaysMinRegex=Bl,xe.isPM=Hl,xe.meridiem=Nl;function Ps(r,e,t,s){var i=Ot(),n=Ct().set(s,e);return i[t](n,r)}function Io(r,e,t){if(It(r)&&(e=r,r=void 0),r=r||"",e!=null)return Ps(r,e,t,"month");var s,i=[];for(s=0;s<12;s++)i[s]=Ps(r,s,t,"month");return i}function yn(r,e,t,s){typeof r=="boolean"?(It(e)&&(t=e,e=void 0),e=e||""):(e=r,t=e,r=!1,It(e)&&(t=e,e=void 0),e=e||"");var i=Ot(),n=r?i._week.dow:0,a,o=[];if(t!=null)return Ps(e,(t+n)%7,s,"day");for(a=0;a<7;a++)o[a]=Ps(e,(a+n)%7,s,"day");return o}function Uh(r,e){return Io(r,e,"months")}function Lh(r,e){return Io(r,e,"monthsShort")}function Yh(r,e,t){return yn(r,e,t,"weekdays")}function Wh(r,e,t){return yn(r,e,t,"weekdaysShort")}function Gh(r,e,t){return yn(r,e,t,"weekdaysMin")}Jt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(r){var e=r%10,t=ae(r%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return r+t}}),W.lang=it("moment.lang is deprecated. Use moment.locale instead.",Jt),W.langData=it("moment.langData is deprecated. Use moment.localeData instead.",Ot);var Mt=Math.abs;function Vh(){var r=this._data;return this._milliseconds=Mt(this._milliseconds),this._days=Mt(this._days),this._months=Mt(this._months),r.milliseconds=Mt(r.milliseconds),r.seconds=Mt(r.seconds),r.minutes=Mt(r.minutes),r.hours=Mt(r.hours),r.months=Mt(r.months),r.years=Mt(r.years),this}function Ho(r,e,t,s){var i=xt(e,t);return r._milliseconds+=s*i._milliseconds,r._days+=s*i._days,r._months+=s*i._months,r._bubble()}function zh(r,e){return Ho(this,r,e,1)}function Kh(r,e){return Ho(this,r,e,-1)}function Po(r){return r<0?Math.floor(r):Math.ceil(r)}function Zh(){var r=this._milliseconds,e=this._days,t=this._months,s=this._data,i,n,a,o,d;return r>=0&&e>=0&&t>=0||r<=0&&e<=0&&t<=0||(r+=Po(wn(t)+e)*864e5,e=0,t=0),s.milliseconds=r%1e3,i=at(r/1e3),s.seconds=i%60,n=at(i/60),s.minutes=n%60,a=at(n/60),s.hours=a%24,e+=at(a/24),d=at($o(e)),t+=d,e-=Po(wn(d)),o=at(t/12),t%=12,s.days=e,s.months=t,s.years=o,this}function $o(r){return r*4800/146097}function wn(r){return r*146097/4800}function Xh(r){if(!this.isValid())return NaN;var e,t,s=this._milliseconds;if(r=nt(r),r==="month"||r==="quarter"||r==="year")switch(e=this._days+s/864e5,t=this._months+$o(e),r){case"month":return t;case"quarter":return t/3;case"year":return t/12}else switch(e=this._days+Math.round(wn(this._months)),r){case"week":return e/7+s/6048e5;case"day":return e+s/864e5;case"hour":return e*24+s/36e5;case"minute":return e*1440+s/6e4;case"second":return e*86400+s/1e3;case"millisecond":return Math.floor(e*864e5)+s;default:throw new Error("Unknown unit "+r)}}function jt(r){return function(){return this.as(r)}}var No=jt("ms"),Jh=jt("s"),Qh=jt("m"),eu=jt("h"),tu=jt("d"),ru=jt("w"),su=jt("M"),iu=jt("Q"),nu=jt("y"),au=No;function ou(){return xt(this)}function cu(r){return r=nt(r),this.isValid()?this[r+"s"]():NaN}function fr(r){return function(){return this.isValid()?this._data[r]:NaN}}var lu=fr("milliseconds"),du=fr("seconds"),hu=fr("minutes"),uu=fr("hours"),fu=fr("days"),gu=fr("months"),xu=fr("years");function pu(){return at(this.days()/7)}var qt=Math.round,Rr={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function mu(r,e,t,s,i){return i.relativeTime(e||1,!!t,r,s)}function vu(r,e,t,s){var i=xt(r).abs(),n=qt(i.as("s")),a=qt(i.as("m")),o=qt(i.as("h")),d=qt(i.as("d")),c=qt(i.as("M")),l=qt(i.as("w")),g=qt(i.as("y")),f=n<=t.ss&&["s",n]||n<t.s&&["ss",n]||a<=1&&["m"]||a<t.m&&["mm",a]||o<=1&&["h"]||o<t.h&&["hh",o]||d<=1&&["d"]||d<t.d&&["dd",d];return t.w!=null&&(f=f||l<=1&&["w"]||l<t.w&&["ww",l]),f=f||c<=1&&["M"]||c<t.M&&["MM",c]||g<=1&&["y"]||["yy",g],f[2]=e,f[3]=+r>0,f[4]=s,mu.apply(null,f)}function yu(r){return r===void 0?qt:typeof r=="function"?(qt=r,!0):!1}function wu(r,e){return Rr[r]===void 0?!1:e===void 0?Rr[r]:(Rr[r]=e,r==="s"&&(Rr.ss=e-1),!0)}function Eu(r,e){if(!this.isValid())return this.localeData().invalidDate();var t=!1,s=Rr,i,n;return typeof r=="object"&&(e=r,r=!1),typeof r=="boolean"&&(t=r),typeof e=="object"&&(s=Object.assign({},Rr,e),e.s!=null&&e.ss==null&&(s.ss=e.s-1)),i=this.localeData(),n=vu(this,!t,s,i),t&&(n=i.pastFuture(+this,n)),i.postformat(n)}var En=Math.abs;function Fr(r){return(r>0)-(r<0)||+r}function $s(){if(!this.isValid())return this.localeData().invalidDate();var r=En(this._milliseconds)/1e3,e=En(this._days),t=En(this._months),s,i,n,a,o=this.asSeconds(),d,c,l,g;return o?(s=at(r/60),i=at(s/60),r%=60,s%=60,n=at(t/12),t%=12,a=r?r.toFixed(3).replace(/\.?0+$/,""):"",d=o<0?"-":"",c=Fr(this._months)!==Fr(o)?"-":"",l=Fr(this._days)!==Fr(o)?"-":"",g=Fr(this._milliseconds)!==Fr(o)?"-":"",d+"P"+(n?c+n+"Y":"")+(t?c+t+"M":"")+(e?l+e+"D":"")+(i||s||r?"T":"")+(i?g+i+"H":"")+(s?g+s+"M":"")+(r?g+a+"S":"")):"P0D"}var le=Rs.prototype;le.isValid=gd,le.abs=Vh,le.add=zh,le.subtract=Kh,le.as=Xh,le.asMilliseconds=No,le.asSeconds=Jh,le.asMinutes=Qh,le.asHours=eu,le.asDays=tu,le.asWeeks=ru,le.asMonths=su,le.asQuarters=iu,le.asYears=nu,le.valueOf=au,le._bubble=Zh,le.clone=ou,le.get=cu,le.milliseconds=lu,le.seconds=du,le.minutes=hu,le.hours=uu,le.days=fu,le.weeks=pu,le.months=gu,le.years=xu,le.humanize=Eu,le.toISOString=$s,le.toString=$s,le.toJSON=$s,le.locale=Co,le.localeData=Do,le.toIsoString=it("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$s),le.lang=_o,Q("X",0,0,"unix"),Q("x",0,0,"valueOf"),X("x",bs),X("X",Uc),ye("X",function(r,e,t){t._d=new Date(parseFloat(r)*1e3)}),ye("x",function(r,e,t){t._d=new Date(ae(r))});//! moment.js
|
|
215
|
+
W.version="2.30.1",bc(_e),W.fn=M,W.min=dd,W.max=hd,W.now=ud,W.utc=Ct,W.unix=jh,W.months=Uh,W.isDate=Yr,W.locale=Jt,W.invalid=ps,W.duration=xt,W.isMoment=ft,W.weekdays=Yh,W.parseZone=qh,W.localeData=Ot,W.isDuration=Fs,W.monthsShort=Lh,W.weekdaysMin=Gh,W.defineLocale=cn,W.updateLocale=ql,W.locales=Ul,W.weekdaysShort=Wh,W.normalizeUnits=nt,W.relativeTimeRounding=yu,W.relativeTimeThreshold=wu,W.calendarFormat=Nd,W.prototype=M,W.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};let Ns=null,Se=null,Oo=null,St=null;function bu(r,e){if(!r||!r.sessionDescriptionHandler)return;const t=r.sessionDescriptionHandler.peerConnection;t&&t.getSenders().forEach(s=>{s.track&&s.track.kind==="audio"&&(s.track.enabled=e)})}function Mo(r){St||(St=document.createElement("audio"),St.id="voxnix-remote-audio",St.autoplay=!0,document.body.appendChild(St));const e=new MediaStream;if(r.sessionDescriptionHandler&&r.sessionDescriptionHandler.peerConnection){r.sessionDescriptionHandler.peerConnection.getReceivers().forEach(s=>{s.track&&e.addTrack(s.track)});const t=r.sessionDescriptionHandler.peerConnection;if(!t._isSetRemoteDescPatched){const s=t.setRemoteDescription.bind(t);t.setRemoteDescription=function(i){if(i&&i.sdp&&i.type==="answer"){const a=(((t.localDescription||{}).sdp||"").match(/^m=/gm)||[]).length,o=(i.sdp.match(/^m=/gm)||[]).length;if(console.log("[RTC Patch] local offer m-lines:",a,"| remote answer m-lines:",o),a>0&&o>a){const d=i.sdp.split(/\r?\n/);let c=0,l=!1;const g=[];for(const w of d)w.startsWith("m=")&&(c++,l=c>a),l||g.push(w);let f=g.join(`\r
|
|
216
|
+
`);f.endsWith(`\r
|
|
217
|
+
`)||(f+=`\r
|
|
218
|
+
`),console.log("[RTC Patch] filtered to",(f.match(/^m=/gm)||[]).length,"m-lines. Applying to Chrome."),i={type:"answer",sdp:f}}}return s(i)},t._isSetRemoteDescPatched=!0}}St.srcObject=e,St.play().catch(t=>console.error("Error playing media:",t))}function jo(){St&&(St.srcObject=null,St.pause())}const Cu=()=>{z.on("incoming_call",()=>{$e.pushSound()}),z.on("local_dial",({number:r})=>{if(Ns){const e=lr.makeURI(`sip:${r}@${Ns.configuration.uri.domain}`),t=new Fa(Ns,e);t.stateChange.addListener(s=>{s===B.Establishing?z.emitLocal("call_status","Calling..."):s===B.Established?(Mo(t),Se=t,z.emitLocal("call_status","InCall")):s===B.Terminated&&(jo(),z.emitLocal("call_status","Idle"),Se=null)}),t.invite()}}),z.on("local_hangup",()=>{$e.stopSound(),Se&&(Se.state===B.Established?Se.bye():typeof Se.reject=="function"?Se.reject():Se.cancel()),z.emitLocal("call_status","Idle"),z.emitLocal("call_duration","00:00"),z.emitToParent("sync_call_ended")}),z.on("local_reject",()=>{$e.stopSound(),Se&&(typeof Se.reject=="function"?Se.reject():Se.cancel()),z.emitLocal("call_status","Idle"),z.emitLocal("call_duration","00:00"),z.emitToParent("sync_call_ended")}),z.on("local_answer",()=>{$e.stopSound();const r={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}}};Se&&Se.accept(r)}),z.on("local_toggle_mute",({muted:r})=>{Se&&bu(Se,!r)}),z.on("local_toggle_hold",({isOnHold:r,setIsOnHold:e})=>{if(Se)try{const t=!r,s={sessionDescriptionHandlerOptions:{hold:t}};Se.invite(s).then(()=>{e(t),console.log(t?"Call successfully put on hold":"Call successfully resumed")}).catch(i=>{console.error("Hold/Unhold failed",i)})}catch(t){console.error("Gagal mengubah status hold:",t)}}),z.on("local_dtmf",({key:r})=>{Se&&Se.sessionDescriptionHandler&&Se.sessionDescriptionHandler.sendDtmf(r)})},_u=async r=>{window.__sipjsEventsBound||(Cu(),window.__sipjsEventsBound=!0);const{auth:e}=r;if(!e)return;const t=e.user_pbx||e.username,s=e.pwd_pbx||e.secret,i=$e.getSipHost(),n=$e.getWssHost(),a=e.port||8089;if(!(!t||!i))try{const o=lr.makeURI(`sip:${t}@${i}`);if(!o)throw new Error("Failed to create SIP URI");const d=`wss://${n}:${a}`,c=new lr({uri:o,transportOptions:{server:d,useSSL:!0,keepAliveInterval:15},authorizationUsername:t,authorizationPassword:s,sessionDescriptionHandlerFactoryOptions:{peerConnectionConfiguration:{iceServers:[]},constraints:{audio:!0,video:!1}},logLevel:"warn",contactParams:{transport:"tls"},registererOptions:{expires:600,refreshFrequency:90}});Ns=c;const l=new Et(c);l.stateChange.addListener(async g=>{var f;if(console.log("NEW STATE",g),g===me.Registered)if(((f=$e.getConfig())==null?void 0:f.autoReady)!==!1)await $e.updateExtensionStatus(t,"Ready","ready")?(z.emitLocal("register_status","REGISTERED"),z.emitLocal("agent_status","READY")):z.emitLocal("register_status",{status:"FAILED",reason:"Failed to hit extension ready API"});else{const y=await $e.fetchExtensionStatus(t),b=y==null?void 0:y.extension_status;let C="NOT_READY";b==="Ready"?C="READY":typeof b=="string"&&b.toLowerCase().startsWith("aux")&&(C="AUX"),z.emitLocal("register_status","SIP_CONNECTED"),z.emitLocal("agent_status",C)}else(g===me.Unregistered||g===me.Terminated)&&z.emitLocal("register_status",{status:"FAILED",reason:"SIP Unregistered or Terminated"})}),c.delegate={onInvite(g){let f=!1;Se=g,z.emitLocal("sipjsSession",g),$e.pushSound(),$e.pushNotification(`New incoming call from ${g.remoteIdentity.uri.user}`),z.emitLocal("incoming_call",g),z.emitToParent("sync_incoming_call",g),g.stateChange.addListener(w=>{if(w===B.Established){Mo(g),f=!0,z.emitLocal("call_status","InCall"),z.emitToParent("sync_call_answered",g);const y=W();Oo=setInterval(()=>{const b=W.duration(W().diff(y));z.emitLocal("call_duration",$e.toHHMMSS(b.asSeconds()))},1e3)}else w===B.Terminated&&(jo(),clearInterval(Oo),$e.stopSound(),z.emitLocal("call_duration","00:00"),z.emitLocal("call_status","Idle"),f?z.emitToParent("sync_call_ended",g):z.emitToParent("sync_call_unanswered"),Se=null)})}},await c.start(),await l.register()}catch(o){console.error("SipJS init error:",o),z.emitLocal("register_status",{status:"FAILED",reason:o.message||"Failed to connect to SIP server"})}},qo={"bottom-left":"bottom-6 left-3 items-start","bottom-right":"bottom-6 right-3 items-end","top-left":"top-6 left-3 items-start","top-right":"top-6 right-3 items-end"};function Du({config:r,placement:e="bottom-left",offset:t,onIncomingCall:s,onCallAnswered:i,onCallEnded:n,onCallUnanswered:a,onRegisterStatus:o,onAgentStatus:d}){const[c,l]=se.useState(!1),[g,f]=se.useState("CONNECTING"),[w,y]=se.useState("NOT_READY"),[b,C]=se.useState(!1),x=se.useRef(!1),p=se.useRef({}),E=(r==null?void 0:r.autoReady)!==!1,_=(r==null?void 0:r.showAuxButton)===!0,R=(r==null?void 0:r.auxOptions)||[];se.useEffect(()=>{p.current={onIncomingCall:s,onCallAnswered:i,onCallEnded:n,onCallUnanswered:a,onRegisterStatus:o,onAgentStatus:d}}),se.useEffect(()=>{var u;r&&$e.setConfig(r);const A=(r==null?void 0:r.auth)||((u=r==null?void 0:r.pabxConfig)==null?void 0:u.auth)||{};!x.current&&(A.username||A.user_pbx)&&(A.pwd_pbx||A.secret)&&(A.pabx_host||A.pbxurl||A.host)&&(x.current=!0,_u({auth:A}))},[r]),se.useEffect(()=>{const A=[z.on("register_status",u=>{var m,U;const v=typeof u=="string"?u:(u==null?void 0:u.status)??"FAILED";f(v),(v==="REGISTERED"||v==="SIP_CONNECTED")&&l(!0),v!=="SIP_CONNECTED"&&((U=(m=p.current).onRegisterStatus)==null||U.call(m,v==="FAILED"?u:v))}),z.on("agent_status",u=>{var v,m;y(u),(m=(v=p.current).onAgentStatus)==null||m.call(v,u)}),z.on("sync_incoming_call",u=>{var v,m;C(!0),l(!0),(m=(v=p.current).onIncomingCall)==null||m.call(v,u)}),z.on("sync_call_answered",u=>{var v,m;C(!1),(m=(v=p.current).onCallAnswered)==null||m.call(v,u)}),z.on("sync_call_ended",u=>{var v,m;C(!1),(m=(v=p.current).onCallEnded)==null||m.call(v,u)}),z.on("sync_call_unanswered",u=>{var v,m;C(!1),(m=(v=p.current).onCallUnanswered)==null||m.call(v,u)})];return()=>A.forEach(u=>u())},[]);const T=qo[e]||qo["bottom-left"],F=g!=="REGISTERED"?g==="FAILED"?"bg-red-500":"bg-blue-400":w==="READY"?"bg-green-500":w==="AUX"?"bg-amber-400":"bg-gray-400",h=t?{position:"fixed",zIndex:9999,...t}:void 0,O=e!=null&&e.includes("right")?"origin-bottom-right":"origin-bottom-left";return S.jsxs("div",{className:t?void 0:`fixed ${T} z-[9999] flex flex-col gap-3`,style:h,children:[S.jsxs("div",{className:`w-[360px] bg-white rounded-3xl overflow-hidden ${O} shadow-[0_20px_60px_rgba(0,0,0,0.18),0_4px_16px_rgba(0,0,0,0.08)] ${c?"animate-slideUp":"hidden"}`,children:[S.jsxs("div",{className:"flex items-center justify-between px-4 py-3.5 bg-gradient-to-r from-[#3f3192] to-[#5240c2]",children:[S.jsx("div",{className:"flex items-center gap-2.5",children:S.jsx("span",{className:"text-white font-semibold text-sm tracking-wide",children:"Voice Widget"})}),S.jsx("button",{onClick:()=>l(!1),className:"text-white/50 hover:text-white transition-colors p-1 rounded-lg",title:"Minimize",children:S.jsx(Xo,{className:"w-4 h-4"})})]}),S.jsx($0,{initialRegisterStatus:g,autoReady:E,showAuxButton:_,auxOptions:R})]}),S.jsxs("button",{onClick:()=>l(A=>!A),className:"w-12 h-12 rounded-full bg-primary hover:bg-primary-hover text-white shadow-lg shadow-primary/30 flex items-center justify-center transition-all active:scale-95 relative",title:"Voice Widget",children:[S.jsx(Or,{className:"w-5 h-5"}),b&&S.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-green-500 border-2 border-white animate-ping"}),S.jsx("span",{className:`absolute -top-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-white ${F}`})]})]})}let er=null,ot=null;function Au(r,e){if(Pr.createRoot){const t=Pr.createRoot(e);return t.render(r),{render:s=>t.render(s),unmount:()=>t.unmount()}}return Pr.render(r,e),{render:t=>Pr.render(t,e),unmount:()=>Pr.unmountComponentAtNode(e)}}const Su={init(r={}){const{container:e,placement:t="bottom-left",offset:s,platform:i="sipjs",auth:n,pabxConfig:a,autoReady:o=!0,showAuxButton:d=!1,auxOptions:c=[],onIncomingCall:l,onCallAnswered:g,onCallEnded:f,onCallUnanswered:w,onRegisterStatus:y,onAgentStatus:b,...C}=r;typeof e=="string"?ot=document.querySelector(e):e instanceof HTMLElement&&(ot=e),ot||(ot=document.createElement("div"),ot.id="omnix-widget-root",document.body.appendChild(ot)),er&&(er.unmount(),er=null);const x=se.createElement(Du,{config:{platform:i,auth:n,pabxConfig:a,autoReady:o,showAuxButton:d,auxOptions:c,...C},placement:t,offset:s,onIncomingCall:l,onCallAnswered:g,onCallEnded:f,onCallUnanswered:w,onRegisterStatus:y,onAgentStatus:b});return er=Au(x,ot),{answer:()=>z.emitLocal("local_answer"),hangup:()=>z.emitLocal("local_hangup"),reject:()=>z.emitLocal("local_reject"),mute:p=>z.emitLocal("local_toggle_mute",{muted:p}),hold:p=>z.emitLocal("local_toggle_hold",{isOnHold:p,setIsOnHold:()=>{}}),dial:p=>z.emitLocal("local_dial",{number:p}),destroy:()=>{er==null||er.unmount(),er=null,(ot==null?void 0:ot.id)==="omnix-widget-root"&&ot.remove(),ot=null}}}};Yt.OmnixWidget=Su,Object.defineProperty(Yt,Symbol.toStringTag,{value:"Module"})});
|